diff --git a/app.js b/app.js index 65bc235..27c6255 100644 --- a/app.js +++ b/app.js @@ -1,82 +1,86 @@ var t = require("setting.js"), o = require("./utils/auth.js"), a = require("./utils/request.js"), e = require("./utils/common.js"), ut = require("./utils/util.js"); -var os=t; +var os = t; var regeneratorRuntime = require('./utils/runtime.js'); var api = require("./api/api.js") - +// import { pluginGD } from './utils/ai_config/config' //公共方法和变量 App({ - def_list:[ - { - "weappurl": "pages/index/index/index", - "nav_name": "首页", - "src": t.imghost+"/miniapp/images/bar/index.png", - "src_sele": t.imghost+"/miniapp/images/bar/index_on.png", - }, - { - "weappurl": "pages/goods/categoryList/categoryList", - "nav_name": "分类", - "src": t.imghost+"/miniapp/images/bar/fl.png", - "src_sele": t.imghost+"/miniapp/images/bar/fl_on.png" - }, - { - "weappurl": "pages/distribution/distribution", - "nav_name": "分销", - "src": t.imghost+"/miniapp/images/bar/fx.png", - "src_sele": t.imghost+"/miniapp/images/bar/fx_on.png" - }, - { - "weappurl": "pages/cart/cart/cart", - "nav_name": "购物车", - "src": t.imghost+"/miniapp/images/bar/car.png", - "src_sele": t.imghost+"/miniapp/images/bar/car_on.png" - }, - { - "weappurl": "pages/user/index/index", - "nav_name": "我的", - "src": t.imghost+"/miniapp/images/bar/user.png", - "src_sele": t.imghost+"/miniapp/images/bar/user_on.png" - } - ], - - globalData: { - cartGoodsNum:0, //购物车总数量 - isTabBar :false, - isIpx: false, //适配IPhoneX - url:"", - setting: t, - wechatUser: null, - userInfo: null, - config: null, //门店参数 - config2: null, //门店配置 - code: null, - user_id:null,//1564704,// 10153869,// 6453964,//5682094, - buy_now:null, - picklist:null, //门店列表 - wuliuprice: null, //物流价格表 - wuliu: null, //物流公司 - baddr:null, - mobile: null, //记录手机 - getu:null, //记录会员信息 - sessionKey: null,//记录会员信息 - openid: null, //记录会员信息 - - to_group:null, //参团传递的数据 - wxapp_buy_obj:null, //微信小程序购买的Object - pk_store:null, //选择的门店 - first_leader:null, //分享会员ID - guide_id:null, //分享导购ID - - windowWidth:0, //整个窗体的宽度 - - room_id:null, //直播间分享的房间ID - room_goods_id:null, //直播间分享的商品ID - - }, + def_list: [ + { + "weappurl": "pages/index/index/index", + "nav_name": "首页", + "src": t.imghost + "/miniapp/images/bar/index.png", + "src_sele": t.imghost + "/miniapp/images/bar/index_on.png", + }, + { + "weappurl": "pages/goods/categoryList/categoryList", + "nav_name": "分类", + "src": t.imghost + "/miniapp/images/bar/fl.png", + "src_sele": t.imghost + "/miniapp/images/bar/fl_on.png" + }, + { + "weappurl": "pages/distribution/distribution", + "nav_name": "分销", + "src": t.imghost + "/miniapp/images/bar/fx.png", + "src_sele": t.imghost + "/miniapp/images/bar/fx_on.png" + }, + { + "weappurl": "pages/cart/cart/cart", + "nav_name": "购物车", + "src": t.imghost + "/miniapp/images/bar/car.png", + "src_sele": t.imghost + "/miniapp/images/bar/car_on.png" + }, + { + "weappurl": "pages/user/index/index", + "nav_name": "我的", + "src": t.imghost + "/miniapp/images/bar/user.png", + "src_sele": t.imghost + "/miniapp/images/bar/user_on.png" + } + ], + + + globalData: { + cartGoodsNum: 0, //购物车总数量 + isTabBar: false, + isIpx: false, //适配IPhoneX + url: "", + setting: t, + wechatUser: null, + userInfo: null, + config: null, //门店参数 + config2: null, //门店配置 + code: null, + user_id: null,//1564704,// 10153869,// 6453964,//5682094,6520044,6520119 qa 4687 6519901 + buy_now: null, + picklist: null, //门店列表 + wuliuprice: null, //物流价格表 + wuliu: null, //物流公司 + baddr: null, + mobile: null, //记录手机 + getu: null, //记录会员信息 + sessionKey: null,//记录会员信息 + openid: null, //记录会员信息 + + to_group: null, //参团传递的数据 + wxapp_buy_obj: null, //微信小程序购买的Object + pk_store: null, //选择的门店 + first_leader: null, //分享会员ID + guide_id: null, //分享导购ID + windowWidth: 0, //整个窗体的宽度 + room_id: null, //直播间分享的房间ID + room_goods_id: null, //直播间分享的商品ID + + }, auth: o, request: a, - onLaunch: function() { - wx.hideTabBar(); + onLaunch: function () { + //初始化美图测肤插件 + // var plugin = requirePlugin('mtSkinSdk'); + // params.login_id = wx.getStorageSync('login_id') || '' // 可将登录id缓存下来,方便下次进入小程序直接获取 + // plugin.setConfig(pluginGD) + + wx.hideTabBar(); this.initExt(); //检查更新 @@ -88,52 +92,52 @@ App({ var clientWidth = wx.getSystemInfoSync().windowWidth; var rpxR = 750 / clientWidth; var calc = wx.getSystemInfoSync().windowHeight * rpxR; - this.globalData.heigth=calc; - this.globalData.windowWidth=clientWidth; + this.globalData.heigth = calc; + this.globalData.windowWidth = clientWidth; - var app=this; - if(!app.globalData.userInfo){ + var app = this; + if (!app.globalData.userInfo) { var user = wx.getStorageSync("userinfo"); - if (user && user.user_id){ - //--生成会员 -- - app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id,{}).then(res=>{ - if(res.data.code==0){ - user=res.data.data; - //-- 小程序会员被解绑了,就要清空会员 -- - if(user['is_weappuser']==0){ - user=null; - app.globalData.userInfo=null; - app.globalData.user_id= 0; - }else{ - app.globalData.userInfo=user; - app.globalData.user_id= user.user_id; - } - wx.setStorageSync("userinfo",user); - }else{ - user=null; - app.globalData.userInfo=null; - app.globalData.user_id= 0; - wx.setStorageSync("userinfo",null); - } - }) + if (user && user.user_id) { + //--生成会员 -- + app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id, {}).then(res => { + if (res.data.code == 0) { + user = res.data.data; + //-- 小程序会员被解绑了,就要清空会员 -- + if (user['is_weappuser'] == 0) { + user = null; + app.globalData.userInfo = null; + app.globalData.user_id = 0; + } else { + app.globalData.userInfo = user; + app.globalData.user_id = user.user_id; + } + wx.setStorageSync("userinfo", user); + } else { + user = null; + app.globalData.userInfo = null; + app.globalData.user_id = 0; + wx.setStorageSync("userinfo", null); + } + }) } } wx.getSystemInfo({ - success: (res) => { - // console.log(res) - let modelmes = res?res.model:null; //手机品牌 - console.log('手机品牌', modelmes) - if (modelmes && modelmes.indexOf('iPhone X') != -1) {  //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来 - this.globalData.isIpx = true - } - }, + success: (res) => { + // console.log(res) + let modelmes = res ? res.model : null; //手机品牌 + console.log('手机品牌', modelmes) + if (modelmes && modelmes.indexOf('iPhone X') != -1) {  //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来 + this.globalData.isIpx = true + } + }, }) - var th=this; + var th = this; var pages = getCurrentPages(); //获取加载的页面 var currentPage = pages[pages.length - 1]; //获取当前页面的对象 - if(!th.globalData.wxapp_buy_obj) { + if (!th.globalData.wxapp_buy_obj) { var turl = "/api/weshop/storeconfig/get/" + th.globalData.setting.stoid; th.promiseGet(turl, {}).then(res => { var o = res; @@ -176,7 +180,7 @@ App({ }) } - else{ + else { var tt = th.globalData.wxapp_buy_obj; if (tt && tt.isout == 1) { th.promiseGet('/api/weshop/store/get/' + t.stoid, {}).then(res => { @@ -202,394 +206,406 @@ App({ }, //---初始化第三方---- - initExt: function() { - var tt=t; + initExt: function () { + var tt = t; console.log("initExt"); console.log(11); var t = wx.getExtConfigSync(), o = this.globalData.setting; console.log(t); - t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt=1; + t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt = 1; }, //首页的第一次登录 - getUserFir(t){ - var s = this; - if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else { - if (!o.isAuth()) return o.wxLogin_fir(t); - if (null == s.globalData.userInfo) { - return o.wxLogin_fir(t); + getUserFir(t) { + var s = this; + if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else { + if (!o.isAuth()) return o.wxLogin_fir(t); + if (null == s.globalData.userInfo) { + return o.wxLogin_fir(t); + } } - } }, - getUserInfo: function(t, n, i) { + getUserInfo: function (t, n, i) { var s = this; if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else { - if (!o.isAuth()) return o.auth(t); - if (null == s.globalData.userInfo){ - return o.auth(t); - } - /*--- - a.get("/api/user/userInfo", { - isShowLoading: void 0 === i || i, - success: function(o) { - s.globalData.userInfo = o.data.result, s.globalData.userInfo.head_pic = e.getFullUrl(s.globalData.userInfo.head_pic), - "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); - } - });--*/ + if (!o.isAuth()) return o.auth(t); + if (null == s.globalData.userInfo) { + return o.auth(t); + } + /*--- + a.get("/api/user/userInfo", { + isShowLoading: void 0 === i || i, + success: function(o) { + s.globalData.userInfo = o.data.result, s.globalData.userInfo.head_pic = e.getFullUrl(s.globalData.userInfo.head_pic), + "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); + } + });--*/ } }, //----------------获取配置参数-------------------- - getConfig: function(t, o) { - var e = this; - if(!e.globalData.setting.stoid){ - t(null); - return false; - } - if(this.globalData.config==undefined) this.globalData.config=null; - this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.requestGet("/api/weshop/store/get/" + e.globalData.setting.stoid, { - success: function(o) { - console.log('getConfig'); - if(o.data.code==0){ + getConfig: function (t, o) { + var e = this; + if (!e.globalData.setting.stoid) { + t(null); + return false; + } + if (this.globalData.config == undefined) this.globalData.config = null; + this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.requestGet("/api/weshop/store/get/" + e.globalData.setting.stoid, { + success: function (o) { + console.log('getConfig', o); + if (o.data.code == 0) { e.globalData.config = o.data.data, "function" == typeof t && t(e.globalData.config); } } }); }, //----------------获取配置参数-------------------- - getConfig2: function (t, o) { - var e = this; - if(!e.globalData.setting.stoid) { - t(null); - return false; - } - this.globalData.config2 && !o ? - "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, { - success: function (o) { - console.log('getConfig2'); - if (o.data.code == 0) { - e.globalData.config2 = o.data.data, "function" == typeof t && t(e.globalData.config2); - } - } - }); - }, - - //----------------获取商家开启的物流-------------------- - getwuliu: function (t, o){ - this.globalData.wuliu=null; - var th = this, st = this.globalData.setting; - //获取物流不缓存 - a.get("/api/weshop/storeshipping/list", { - data: { store_id: st.stoid, status: 1, pageSize:2000 }, - success: function (o) { - console.log('getwuliu'); - console.log(o); - if (o.data.code == 0 && o.data.data && o.data.data.pageData && o.data.data.pageData.length>0) { - var arr = o.data.data.pageData; - console.log(arr); - arr.forEach(function(item,index){ - arr[index].code = item.shipping_code; arr[index].name = item.shipping_name; - }) - th.globalData.wuliu = arr, "function" == typeof t && t(arr); - } + getConfig2: function (t, o) { + var e = this; + if (!e.globalData.setting.stoid) { + t(null); + return false; } - }); - }, - - //----------------获取物流价格表-------------------- - getwuliuprice: function (t, o) { - var e = this,th=e, st = this.globalData.setting; - //获取物流不缓存 - a.get("/api/weshop/shippingarea/list",{ - data: { store_id: st.stoid,pageSize: 2000 }, - success: function (o) { - console.log('getwuliuprice'); - console.log(o); - if (o.data.code == 0) { - var arr=o.data.data.pageData; - console.log(arr); - if (arr.length>0){ - for (var i = 0; i < arr.length;i++){ - arr[i].code = arr[i].shipping_code; - if (arr[i].json_config != "" && arr[i].json_config != undefined && arr[i].json_config != null ) - arr[i].config = JSON.parse(arr[i].json_config); - } - } - th.globalData.wuliuprice = o.data.data, "function" == typeof t && t(e.globalData.wuliuprice); - } - } - }); - }, + this.globalData.config2 && !o ? + "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, { + success: function (o) { + console.log('getConfig2'); + if (o.data.code == 0) { + e.globalData.config2 = o.data.data, "function" == typeof t && t(e.globalData.config2); + } + } + }); + }, + + //----------------获取商家开启的物流-------------------- + getwuliu: function (t, o) { + this.globalData.wuliu = null; + var th = this, st = this.globalData.setting; + //获取物流不缓存 + a.get("/api/weshop/storeshipping/list", { + data: { store_id: st.stoid, status: 1, pageSize: 2000 }, + success: function (o) { + console.log('getwuliu'); + console.log(o); + if (o.data.code == 0 && o.data.data && o.data.data.pageData && o.data.data.pageData.length > 0) { + var arr = o.data.data.pageData; + console.log(arr); + arr.forEach(function (item, index) { + arr[index].code = item.shipping_code; arr[index].name = item.shipping_name; + }) + th.globalData.wuliu = arr, "function" == typeof t && t(arr); + } + } + }); + }, + + //----------------获取物流价格表-------------------- + getwuliuprice: function (t, o) { + var e = this, th = e, st = this.globalData.setting; + //获取物流不缓存 + a.get("/api/weshop/shippingarea/list", { + data: { store_id: st.stoid, pageSize: 2000 }, + success: function (o) { + console.log('getwuliuprice'); + console.log(o); + if (o.data.code == 0) { + var arr = o.data.data.pageData; + console.log(arr); + if (arr.length > 0) { + for (var i = 0; i < arr.length; i++) { + arr[i].code = arr[i].shipping_code; + if (arr[i].json_config != "" && arr[i].json_config != undefined && arr[i].json_config != null) + arr[i].config = JSON.parse(arr[i].json_config); + } + } + th.globalData.wuliuprice = o.data.data, "function" == typeof t && t(e.globalData.wuliuprice); + } + } + }); + }, //----------------设置立即购买数组-------------------- - set_b_now: function (d) { this.globalData.buy_now=d;}, - get_b_now: function () {return this.globalData.buy_now}, + set_b_now: function (d) { this.globalData.buy_now = d; }, + get_b_now: function () { return this.globalData.buy_now }, - getPrevPageData: function(t) { + getPrevPageData: function (t) { void 0 === t && (t = 1); var o = getCurrentPages(); return o[o.length - t - 1].data; }, - showLoading: function(t, o) { + showLoading: function (t, o) { void 0 === o && (o = 1500), wx.showToast({ title: "加载中", icon: "loading", duration: o, mask: !0, - complete: function() { + complete: function () { "function" == typeof t && setTimeout(t, o); } }); }, - showSuccess: function(t, o, a) { + showSuccess: function (t, o, a) { void 0 === a && (a = 1e3), wx.showToast({ title: t, icon: "success", duration: a, mask: !0, - complete: function() { + complete: function () { "function" == typeof o && setTimeout(o, a); } }); }, - showWarning: function(t, o, a, e) { + showWarning: function (t, o, a, e) { //var imghost=this.globalData.setting.imghost; !a && (a = 1500), void 0 === e && (e = !0), wx.showToast({ title: t, mask: e, duration: a, - image:"/images/gt.png", - complete: function() { + icon: 'error', + // image: "/images/gt.png", + complete: function () { "function" == typeof o && setTimeout(o, a); } }); }, - confirmBox: function(t, o) { + confirmBox: function (t, o) { wx.showModal({ title: t, showCancel: !1, - complete: function() { + complete: function () { "function" == typeof o && o(); } }); }, //----------获取所有的门店------------ - get_allsto(func){ - var th=this; - if (this.globalData.picklist!=null){ - "function" == typeof func && func(th.globalData.picklist); - }else{ - th.request.get("/api/weshop/pickup/page", { - data: { store_id: th.globalData.setting.stoid, pageSize: 600 }, - success: function (da) { - //设置门店 - //th.setData({ allsto: da.data.data.pageData }); - th.globalData.picklist = da.data.data.pageData; - "function" == typeof func && func(th.globalData.picklist); - } - }) + get_allsto(func) { + var th = this; + if (this.globalData.picklist != null) { + "function" == typeof func && func(th.globalData.picklist); + } else { + th.request.get("/api/weshop/pickup/page", { + data: { store_id: th.globalData.setting.stoid, pageSize: 600 }, + success: function (da) { + //设置门店 + //th.setData({ allsto: da.data.data.pageData }); + th.globalData.picklist = da.data.data.pageData; + "function" == typeof func && func(th.globalData.picklist); + } + }) } }, //同步化,在调用的时候要await - async get_isbuy(func) { - var th=this - var stoid=os.stoid; - - await this.promiseGet("/store/storemoduleendtime/page?store_id=" +stoid + "&type=5",{}).then(res=>{ - var o=res; - if (o.data.code == 0) { - var ob = { isout: 0, isbuy: 1 }; - var arr = o.data.data.pageData; - var isbuy = 0; - //----如果数组不为空---- - if (arr.length > 0) { - arr.forEach(function (val, ind) { - if (val.is_sy == 0 && val.type == 5) { - isbuy = 1; - var now = ut.gettimestamp(); - if (now > val.end_time) ob.isout = 1; - return false; - } - }) - } - ob.isbuy = isbuy; - th.globalData.wxapp_buy_obj=ob; - if(func){ - func(); - } + async get_isbuy(func) { + var th = this + var stoid = os.stoid; + + await this.promiseGet("/store/storemoduleendtime/page?store_id=" + stoid + "&type=5", {}).then(res => { + var o = res; + if (o.data.code == 0) { + var ob = { isout: 0, isbuy: 1 }; + var arr = o.data.data.pageData; + var isbuy = 0; + //----如果数组不为空---- + if (arr.length > 0) { + arr.forEach(function (val, ind) { + if (val.is_sy == 0 && val.type == 5) { + isbuy = 1; + var now = ut.gettimestamp(); + if (now > val.end_time) ob.isout = 1; + return false; + } + }) + } + ob.isbuy = isbuy; + th.globalData.wxapp_buy_obj = ob; + if (func) { + func(); + } + } + }) + }, + //获取场景值 判断是否是单页面 + is_Single_page(_this,func) { + let scene = wx.getLaunchOptionsSync().scene; + //--判断是否是单页面-- + if(scene !== 1154){ + typeof func =="function" && func.bind(_this)(); + }else{ + return false; } - }) + // return scene == 1154? false:true; }, + //--同步化,在调用的时候要await,获取商家config-- - async getConfig_ays(){ - if(this.globalData.config!=null) return false; - var th=this; - await api.get_config(this.globalData.setting.stoid).then(res=>{ - var o=res; - if(o.data.code==0){ - th.globalData.config = o.data.data; - } - }) + async getConfig_ays() { + if (this.globalData.config != null) return false; + var th = this; + await api.get_config(this.globalData.setting.stoid).then(res => { + var o = res; + if (o.data.code == 0) { + th.globalData.config = o.data.data; + } + }) }, //----智能跳转,判断 非tabBar,tabBar页面的跳转---- - goto:function (url) { - var arr=getCurrentPages(); - if(arr.length>8){ - arr.splice(0, 2); - } - var arr_tabbar=["/pages/index/index/index", - "/pages/goods/categoryList/categoryList", - "/pages/goods/categoryList/categoryList?type=2", - "/pages/goods/categoryList/categoryList?type=1", - "/pages/cart/cart/cart","/pages/user/index/index", - "/pages/distribution/distribution"]; - if(arr_tabbar.indexOf(url)!=-1){ - if(url.indexOf("categoryList?type=1")!=-1) this.globalData.cat_type=1; - if(url.indexOf("categoryList?type=2")!=-1) this.globalData.cat_type=2; - wx.switchTab({url: url,}) //跳到tabbar页 - - }else{ + goto: function (url) { + var arr = getCurrentPages(); + if (arr.length > 8) { + arr.splice(0, 2); + } + var arr_tabbar = ["/pages/index/index/index", + "/pages/goods/categoryList/categoryList", + "/pages/goods/categoryList/categoryList?type=2", + "/pages/goods/categoryList/categoryList?type=1", + "/pages/cart/cart/cart", "/pages/user/index/index", + "/pages/distribution/distribution"]; + if (arr_tabbar.indexOf(url) != -1) { + if (url.indexOf("categoryList?type=1") != -1) this.globalData.cat_type = 1; + if (url.indexOf("categoryList?type=2") != -1) this.globalData.cat_type = 2; + wx.switchTab({ url: url, }) //跳到tabbar页 + + } else { if (getCurrentPages().length > 9) { - wx.redirectTo({url: url,}) //跳到非tabbar页 - }else{ - wx.navigateTo({url: url,}) //跳到tabbar页 + wx.redirectTo({ url: url, }) //跳到非tabbar页 + } else { + wx.navigateTo({ url: url, }) //跳到tabbar页 } } //wx.navigateTo({ url: url, }) //跳到非tabbar页 }, //显示提示,word提示内容,type 0失败,提示 1成功 - my_warnning(word,type,that,width){ + my_warnning(word, type, that, width) { var warn = that.selectComponent("#warn"); //组件的id - warn.open(word,type,width); + warn.open(word, type, width); return 1; }, //获取会员门店 - get_user_store:function (func) - { - var th=this; + get_user_store: function (func) { + var th = this; this.getConfig2(function (conf) { //---空会员的情况--- - if(!th.globalData.userInfo){ + if (!th.globalData.userInfo) { return func(null); } - if(!th.globalData.pk_store){ - var pick_id=0; + if (!th.globalData.pk_store) { + var pick_id = 0; //先找一个会员是否有设置默认的地址 - if(th.globalData.userInfo.def_pickup_id){ - pick_id= th.globalData.userInfo.def_pickup_id + if (th.globalData.userInfo.def_pickup_id) { + pick_id = th.globalData.userInfo.def_pickup_id } //查找会员的注册的地址 - else if(th.globalData.userInfo.pickup_id){ + else if (th.globalData.userInfo.pickup_id) { //--购买门店是否默认登记门店-- - if(conf.switch_list){ - var t_swi=JSON.parse(conf.switch_list); - if(t_swi.is_regstores){ - pick_id= th.globalData.userInfo.pickup_id + if (conf.switch_list) { + var t_swi = JSON.parse(conf.switch_list); + if (t_swi.is_regstores) { + pick_id = th.globalData.userInfo.pickup_id } } } //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店-- - if(pick_id==0) return func(null); - - //返回门店的数量 - th.get_pk_num(function(num){ - //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭 - th.request.get("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{ - data:{}, - success:function (res) { - th.globalData.pk_store=null; - if(res.data.code==0 && res.data.data && res.data.data.isstop==0 && res.data.data.is_pos==1){ - - //--门店的数量大于10个才要关心门店的分类有没有关闭-- - if(res.data.data.category_id && num>10){ - th.request.get( "/api/weshop/storagecategory/get/"+os.stoid+"/"+res.data.data.category_id, { - data: {}, - success: function (ee) { - if(ee.data.code==0 && ee.data.data ){ - if(ee.data.data.is_show==1){ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - }else{ - //看一下有没有显示的门店分类 - getApp().request.get("/api/weshop/storagecategory/page", { - data: { - store_id: os.stoid, - is_show: 1, - pageSize: 1, - }, - success: function (ee) { - if(ee.data.code==0){ - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){ - func(null); - }else{ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - } - }else{ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - } - } - }) - } - }else{ + if (pick_id == 0) return func(null); + + //返回门店的数量 + th.get_pk_num(function (num) { + //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭 + th.request.get("/api/weshop/pickup/get/" + os.stoid + "/" + pick_id, { + data: {}, + success: function (res) { + th.globalData.pk_store = null; + if (res.data.code == 0 && res.data.data && res.data.data.isstop == 0 && res.data.data.is_pos == 1) { + + //--门店的数量大于10个才要关心门店的分类有没有关闭-- + if (res.data.data.category_id && num > 10) { + th.request.get("/api/weshop/storagecategory/get/" + os.stoid + "/" + res.data.data.category_id, { + data: {}, + success: function (ee) { + if (ee.data.code == 0 && ee.data.data) { + if (ee.data.data.is_show == 1) { + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + } else { + //看一下有没有显示的门店分类 + getApp().request.get("/api/weshop/storagecategory/page", { + data: { + store_id: os.stoid, + is_show: 1, + pageSize: 1, + }, + success: function (ee) { + if (ee.data.code == 0) { + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) { + func(null); + } else { + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + } + } else { + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + } + } + }) + } + } else { func(null); - } - } - }) - }else{ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - } - }else{ - func(null); - } - } - }) - - }) - - }else{ + } + } + }) + } else { + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + } + } else { + func(null); + } + } + }) + + }) + + } else { func(th.globalData.pk_store); } }) }, - - //-- 获取门店的数量 -- - get_pk_num:function(func){ - this.request.get("/api/weshop/pickup/page",{ - data:{page:1,pageSize:1,isstop:0,store_id:os.stoid}, - success:function (res) { - if(res.data.code==0){ - func(res.data.data.total); //门店数量 - } - } - }); - }, + + //-- 获取门店的数量 -- + get_pk_num: function (func) { + this.request.get("/api/weshop/pickup/page", { + data: { page: 1, pageSize: 1, isstop: 0, store_id: os.stoid }, + success: function (res) { + if (res.data.code == 0) { + func(res.data.data.total); //门店数量 + } + } + }); + }, //-------获取购物车数量---------- - requestCardNum: function(th) { - if(!this.globalData.user_id) return false; - var that=this; + requestCardNum: function (th) { + if (!this.globalData.user_id) return false; + var that = this; this.request.get("/api/weshop/cart/page", { - isShoeLoading:false, + isShoeLoading: false, data: { store_id: this.globalData.setting.stoid, user_id: this.globalData.user_id, - state:0, - is_gift:0, - pageSize:300 + state: 0, + is_gift: 0, + pageSize: 300 }, - success: function(e) { + success: function (e) { var num = 0; - if(e.data.data && e.data.data.pageData) { + if (e.data.data && e.data.data.pageData) { for (var i = 0; i < e.data.data.pageData.length; i++) { num += e.data.data.pageData[i].goods_num; } @@ -600,131 +616,131 @@ App({ text: '' + num //显示的内容 });--*/ //-- 读取服务卡的数量 -- - that.promiseGet("/api/weshop/cartService/page",{ - data:{ + that.promiseGet("/api/weshop/cartService/page", { + data: { store_id: that.globalData.setting.stoid, user_id: that.globalData.user_id, } - }).then(res=>{ + }).then(res => { for (var i = 0; i < res.data.data.pageData.length; i++) { num += res.data.data.pageData[i].goods_num; } - that.globalData.cartGoodsNum=num; + that.globalData.cartGoodsNum = num; th.data.up_dating = 0 - th.getTabBar().setData({cartGoodsNum:num}); + th.getTabBar().setData({ cartGoodsNum: num }); }) } }); }, - - //------定时等待某个值,有值才进行运算-------- - waitfor:function(page,key,pop_value,func){ - var n=0; - if(!page.data[key]){ - page.data[key]=setInterval(function(){ - console.log(page.data[key]);n++; - if(pop_value) { - clearInterval(page.data[key]); - func(); - } - if(n>15) clearInterval(page.data[key]); - },1000); - } - }, - - //------定时等待某个值,有值才进行运算-------- - waitfor2:function(page,key,pop_value_key,func){ - var n=0; - if(!page.data[key]){ - page.data[key]=setInterval(function(){ - console.log(page.data[key]);n++; - if(page.data[pop_value_key] && Object.keys(page.data[pop_value_key]).length>0) { - clearInterval(page.data[key]); - func(); - } - if(n>15){ + + //------定时等待某个值,有值才进行运算-------- + waitfor: function (page, key, pop_value, func) { + var n = 0; + if (!page.data[key]) { + page.data[key] = setInterval(function () { + console.log(page.data[key]); n++; + if (pop_value) { + clearInterval(page.data[key]); + func(); + } + if (n > 15) clearInterval(page.data[key]); + }, 1000); + } + }, + + //------定时等待某个值,有值才进行运算-------- + waitfor2: function (page, key, pop_value_key, func) { + var n = 0; + if (!page.data[key]) { + page.data[key] = setInterval(function () { + console.log(page.data[key]); n++; + if (page.data[pop_value_key] && Object.keys(page.data[pop_value_key]).length > 0) { + clearInterval(page.data[key]); + func(); + } + if (n > 15) { clearInterval(page.data[key]); func(); } - },1000); - } - }, + }, 1000); + } + }, //清空登录时候缓存的值 - onHide:function () { - this.globalData.is_test=0; - this.globalData.guide_id=null; //导购清空 - this.globalData.first_leader=null; //分享的会员清空 - this.globalData.wuliu=null; //关闭要把物流清空 - this.globalData.room_id=null; //关闭要把房间号关闭 - this.globalData.room_goods_id=null; //关闭要把物流清空 - this.globalData.config2=null; //清除config2的缓存 - this.globalData.config=null; //清除config的缓存 - this.globalData.gr_index=0; //商品分组的序列 - this.globalData.pk_store=null; - this.globalData.wxapp_buy_obj=null; - this.globalData.dis_buy_obj=null; //等级卡的购买记录 - this.globalData.storeFooter=null; //底部的导航 - this.globalData.full_screen=null; //全屏 - - }, - - clear_word:function (word) { - - var str=word; - let reg = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n])|(\s)/g , - indexArr = reg.exec(str); - if(str.match(reg)) { - str = str.replace(reg, ''); + onHide: function () { + this.globalData.is_test = 0; + this.globalData.guide_id = null; //导购清空 + this.globalData.first_leader = null; //分享的会员清空 + this.globalData.wuliu = null; //关闭要把物流清空 + this.globalData.room_id = null; //关闭要把房间号关闭 + this.globalData.room_goods_id = null; //关闭要把物流清空 + this.globalData.config2 = null; //清除config2的缓存 + this.globalData.config = null; //清除config的缓存 + this.globalData.gr_index = 0; //商品分组的序列 + this.globalData.pk_store = null; + this.globalData.wxapp_buy_obj = null; + this.globalData.dis_buy_obj = null; //等级卡的购买记录 + this.globalData.storeFooter = null; //底部的导航 + this.globalData.full_screen = null; //全屏 + + }, + + clear_word: function (word) { + + var str = word; + let reg = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n])|(\s)/g, + indexArr = reg.exec(str); + if (str.match(reg)) { + str = str.replace(reg, ''); + } + return str; + }, + + getPageIndex: function (curPage) { + + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + + var index = 0; + + if (this.globalData.custum_data) { + var itemList = this.globalData.custum_data.data; + itemList = JSON.parse(itemList); + for (var i in itemList) { + var item = itemList[i] + if (pagePath.indexOf(item.weappurl) != -1) { + index = i; break; + } + } + + } else { + var itemList = this.def_list; + for (var i in itemList) { + var item = itemList[i] + if (pagePath.indexOf(item.weappurl) != -1) { + index = i; break; + } } - return str; - }, - - getPageIndex:function(curPage){ - - var pagePath = curPage.route; //当前页面url - if (pagePath.indexOf('/') != 0) { - pagePath = '/' + pagePath; - } - - var index=0; - - if(this.globalData.custum_data){ - var itemList = this.globalData.custum_data.data; - itemList = JSON.parse(itemList); - for(var i in itemList){ - var item=itemList[i] - if(pagePath.indexOf(item.weappurl)!=-1){ - index=i;break; - } - } - - }else{ - var itemList=this.def_list; - for(var i in itemList){ - var item=itemList[i] - if(pagePath.indexOf(item.weappurl)!=-1){ - index=i;break; - } - } - } - return index; - - }, + } + return index; + + }, //---promise的使用get---- - promiseGet:function(url,data){ - if(url.indexOf("http")==-1) url=this.globalData.setting.url +url; + promiseGet: function (url, data) { + if (url.indexOf("http") == -1) url = this.globalData.setting.url + url; return new Promise((resolve, reject) => { data.isShowLoading && wx.showLoading(); wx.request({ url, method: 'GET', - header: {"content-type": "application/x-www-form-urlencoded" }, - data:data.data, + header: { "content-type": "application/x-www-form-urlencoded" }, + data: data.data, success(res) { data.isShowLoading && wx.hideLoading(); resolve(res); @@ -736,40 +752,40 @@ App({ //---promise的使用get---- - requestGet:function(url,data){ - if(url.indexOf("http")==-1) url=this.globalData.setting.url +url; - data.isShowLoading && wx.showLoading(); - wx.request({ - url, - method: 'GET', - header: {"content-type": "application/x-www-form-urlencoded" }, - data:data.data, - success(res) { - data.isShowLoading && wx.hideLoading(); - data.success(res); - }, - fail(err) { - data.isShowLoading && wx.hideLoading(); - if(data.fail) data.fail(err); - } - }) + requestGet: function (url, data) { + if (url.indexOf("http") == -1) url = this.globalData.setting.url + url; + data.isShowLoading && wx.showLoading(); + wx.request({ + url, + method: 'GET', + header: { "content-type": "application/x-www-form-urlencoded" }, + data: data.data, + success(res) { + data.isShowLoading && wx.hideLoading(); + data.success(res); + }, + fail(err) { + data.isShowLoading && wx.hideLoading(); + if (data.fail) data.fail(err); + } + }) + }, + + + // 判断是否登录 + isLogin() { + return new Promise(function (resolve, reject) { + let user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + return false; + } else { + resolve(user_info); + }; + }); }, - - - // 判断是否登录 - isLogin() { - return new Promise(function(resolve, reject) { - let user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - wx.navigateTo({ - url: '/pages/togoin/togoin', - }) - return false; - } else { - resolve(user_info); - }; - }); - }, checkUpdateVersion() { @@ -777,19 +793,21 @@ App({ if (wx.canIUse('getUpdateManager')) { //创建 UpdateManager 实例 const updateManager = wx.getUpdateManager(); - console.log('是否进入模拟更新'); + if(!updateManager) { + return false; + } //检测版本更新 - updateManager.onCheckForUpdate(function(res) { + updateManager.onCheckForUpdate(function (res) { console.log('是否获取版本'); // 请求完新版本信息的回调 if (res.hasUpdate) { //监听小程序有版本更新事件 - updateManager.onUpdateReady(function() { + updateManager.onUpdateReady(function () { //TODO 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 ( 此处进行了自动更新操作) updateManager.applyUpdate(); }) - updateManager.onUpdateFailed(function() { + updateManager.onUpdateFailed(function () { // 新版本下载失败 wx.showModal({ title: '已经有新版本喽~', @@ -810,6 +828,6 @@ App({ - + }); diff --git a/app.json b/app.json index 15d90df..bacfe0c 100644 --- a/app.json +++ b/app.json @@ -19,10 +19,8 @@ "pages/user/coupon/coupon", "pages/user/checkcoupon/checkcoupon", "pages/user/add_address/add_address", - "pages/user/withdrawals_list/withdrawals_list", "pages/user/return_goods_info/return_goods_info", "pages/user/return_goods/return_goods", - "pages/user/withdrawals/withdrawals", "pages/user/express/express", "pages/user/get_user_info/get_user_info", "pages/activity/seckill_list/seckill_list", @@ -155,7 +153,6 @@ "pages/video/index", "pages/boxes-list/boxes-list", "pages/boxes-details/boxes-details" - ] }, { @@ -195,6 +192,7 @@ "pages/AI-test-skin/analyse/analyse" ] } + ], "permission": { "scope.userLocation": { @@ -256,4 +254,5 @@ "useExtendedLib": { "weui": true } + } \ No newline at end of file diff --git a/app.wxss b/app.wxss index dc1f3e3..aa2467b 100644 --- a/app.wxss +++ b/app.wxss @@ -743,9 +743,25 @@ background: #ffe3e2; /* 图标字体(ty) */ @font-face { font-family: 'iconfont'; /* Project id 2054717 */ - src: url('//at.alicdn.com/t/font_2054717_lrw1n4v54a9.woff2?t=1645426251412') format('woff2'), - url('//at.alicdn.com/t/font_2054717_lrw1n4v54a9.woff?t=1645426251412') format('woff'), - url('//at.alicdn.com/t/font_2054717_lrw1n4v54a9.ttf?t=1645426251412') format('truetype'); + src: url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.woff2?t=1645781927179') format('woff2'), + url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.woff?t=1645781927179') format('woff'), + url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.ttf?t=1645781927179') format('truetype'); +} + +.icon-infofill:before { + content: "\e6e6"; +} + +.icon-geren:before { + content: "\e71d"; +} + +.icon-tupian:before { + content: "\e997"; +} + +.icon-wenhao:before { + content: "\e72d"; } .icon-suoxiao:before { diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index 6064565..3092772 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -46,6 +46,7 @@ Component({ title_index: 0, swiper_hei: 0, title_class: "", + is_no_plus: 1, }, ready: function () { }, @@ -106,7 +107,7 @@ Component({ } if (this.data.object.bg_color) { this.setData({ - bg_color:this.data.object.bg_color, + bg_color: this.data.object.bg_color, }) } this.setData({ @@ -190,38 +191,8 @@ Component({ th.data.loading = 0; if (res.data.code == 0 && res.data.data) { - var goods = res.data.data; - /*-- - var rData = th.data.requestData; - if (rData == null) rData=[]; - var now=ut.gettimestamp(); - - var new_arr=[]; - for (var ii in res.data.data){ - var item=res.data.data[ii]; - item.goods_img=th.data.imghost + item.original_img; - if(item.e_timenow) {item.prom_type=0; item.prom_price=0;} - new_arr.push(item); - } - rData = rData.concat(new_arr); - - th.data.requestData = rData; - - if(th.data.object.column==5){ - var arr = new Array(); - //--三个三个一组--- - for(var i=0;i< rData.length;i+=3){ - arr.push(rData.slice(i,i+3)); - } - th.setData({ goods_array: arr }); - }else{ - th.setData({ goods_array: rData }); - }--*/ - th.set_good(goods); - //---控制有没有加载更多的按钮--- if (th.data.firist_type_curr >= len) { th.setData({ goods_btn: [] }); } else th.setData({ goods_btn: [1, 2] }); @@ -362,6 +333,21 @@ Component({ }) } }) + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) }, @@ -455,7 +441,6 @@ Component({ var val = goods[i]; var item = {}; var prom_id = null; - //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { var url = "/api/weshop/activitylist/getGoodActInfo"; var req_data = { diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxml b/components/diy_goodsGroup/diy_goodsGroup.wxml index f73d30d..4b4ad3c 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.wxml +++ b/components/diy_goodsGroup/diy_goodsGroup.wxml @@ -102,7 +102,7 @@ - + @@ -253,7 +253,7 @@ - + @@ -403,7 +403,7 @@ - + @@ -577,7 +577,7 @@ - {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2) && is_no_plus}} {{g_filter.get_card_price(item,card_list,1)}} @@ -734,7 +734,7 @@ - + diff --git a/components/diy_luckyGo/diy_luckyGo.js b/components/diy_luckyGo/diy_luckyGo.js index 245e973..c5a47ba 100644 --- a/components/diy_luckyGo/diy_luckyGo.js +++ b/components/diy_luckyGo/diy_luckyGo.js @@ -1,9 +1,3 @@ -// var e = function(e) { -// return e && e.__esModule ? e : { -// default: e -// }; -// }(require("../../utils/LoadMore3.js")), -// n = new e.default(), var t = getApp(), a = t.request, o = t.globalData.setting, diff --git a/components/diy_pingd_buy/diy_pingd_buy.js b/components/diy_pingd_buy/diy_pingd_buy.js index 26d126f..a33ca6c 100644 --- a/components/diy_pingd_buy/diy_pingd_buy.js +++ b/components/diy_pingd_buy/diy_pingd_buy.js @@ -1,9 +1,4 @@ -// var e = function(e) { -// return e && e.__esModule ? e : { -// default: e -// }; -// }(require("../../utils/LoadMore3.js")), -// n = new e.default(), + var t = getApp(), a = t.request, o = t.globalData.setting, diff --git a/components/diy_richtext/diy_richtext.js b/components/diy_richtext/diy_richtext.js index 67c2ba9..b58c5df 100644 --- a/components/diy_richtext/diy_richtext.js +++ b/components/diy_richtext/diy_richtext.js @@ -4,7 +4,7 @@ Component({ nodes: { type: String, - value: '

javascript - js同步编程与异步编程的区别,异步有哪些优点,为什么...

2016年5月20日 - 从编程方式来讲当然是同步编程的方式更为简单,但是同步有其局限性一是假如是单线程那么一旦遇到阻塞调用,会造成整个线程阻塞,导致cpu无法得到有效利用...
 - 百度快照
为您推荐:js同步和异步ajax异步和同步的区别
', + value: '', }, my:{ type: String, diff --git a/components/diy_richtext/diy_richtext.wxml b/components/diy_richtext/diy_richtext.wxml index ec52b63..affb040 100644 --- a/components/diy_richtext/diy_richtext.wxml +++ b/components/diy_richtext/diy_richtext.wxml @@ -1,11 +1,2 @@ - - - - - diff --git a/components/diy_seckill/diy_seckill.wxml b/components/diy_seckill/diy_seckill.wxml index ceafe44..3b000d9 100644 --- a/components/diy_seckill/diy_seckill.wxml +++ b/components/diy_seckill/diy_seckill.wxml @@ -15,7 +15,8 @@ - + + @@ -74,10 +75,13 @@ + + - + + diff --git a/components/diy_serviceCard/diy_serviceCard.js b/components/diy_serviceCard/diy_serviceCard.js index 5d74dd5..c0d9d34 100644 --- a/components/diy_serviceCard/diy_serviceCard.js +++ b/components/diy_serviceCard/diy_serviceCard.js @@ -226,33 +226,6 @@ Component({ if (res.data.code == 0 && res.data.data) { var goods = res.data.data.pageData; - // console.log('goods', goods); - // var rData = th.data.requestData; - // if (rData == null) rData=[]; - // var now=ut.gettimestamp(); - - // var new_arr=[]; - // for (var ii in res.data.data){ - // var item=res.data.data[ii]; - // item.goods_img=th.data.imghost + item.original_img; - // if(item.e_timenow) {item.prom_type=0; item.prom_price=0;} - // new_arr.push(item); - // } - // rData = rData.concat(new_arr); - - // th.data.requestData = rData; - - // if(th.data.object.column==5){ - // var arr = new Array(); - // //--三个三个一组--- - // for(var i=0;i< rData.length;i+=3){ - // arr.push(rData.slice(i,i+3)); - // } - // th.setData({ goods_array: arr }); - // }else{ - // th.setData({ goods_array: rData }); - // }-- th.set_good(goods); @@ -353,91 +326,13 @@ Component({ //---卡的初始化---- card_init: function() { - // var th = this, - // os = getApp().globalData.setting; - // if (!getApp().globalData.user_id) return false; - // getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { - // isShowLoading: false, - // success: function(e) { - // getApp().globalData.userInfo = e.data.data; - // getApp().getConfig2(function(e) { - // var swithc_list = e.switch_list; - // var sw_arr = JSON.parse(swithc_list); - // //---如果后台又开等级卡的开关--- - // if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { - // th.setData({ - // rank_switch: true - // }); - // //---回调卡的列表--- - // th.getPlusCardType(function(ob) { - // th.setData({ - // card_list: ob.card_list - // }); - // var ti = setInterval(function() { - // var user = getApp().globalData.userInfo; - // if (!user) return false; - // clearInterval(ti); - - // if (user.card_field && user['card_expiredate']) { - // var str = user['card_expiredate'].replace(/-/g, '/'); - // var end = new Date(str); - // end = Date.parse(end) / 1000; - // var now = ut.gettimestamp(); - - // //--- 判断是等级会员,且在有效期范围内 --- - // if (user.card_field && now < end) { - // var card_name = ob.name_map.get(user.card_field); - // if (card_name.length > 4) card_name = card_name.substring(0, 4); - // th.setData({ - // card_field: user.card_field, - // card_name: card_name, - // card_list: ob.card_list - // }); - // } - - // } - - // }, 500) - // }) - - // } - // }) - // } - // }) + }, //--- 获取卡类列表 --- getPlusCardType: function(func) { - // var storid = o.stoid; - // var th = this; - // getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { - // var plusCard = res.data.data; - // var arr = [1219, 2089, 3031]; - // var new_arr = new Array(); - // var card_name_map = new Map(); - - // var user = getApp().globalData.userInfo; - - // if (plusCard) { - - // for (var i = 0; i < plusCard.length; i++) { - // if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { - // continue; - // } - - // var name = "card" + plusCard[i].CorrPrice.toLowerCase(); - // card_name_map.set(name, plusCard[i].CardName); - // new_arr.push(plusCard[i]); - // } - // } - - // var ob = { - // "card_list": new_arr, - // "name_map": card_name_map - // }; - // func(ob); - // }) + }, @@ -499,32 +394,13 @@ Component({ var now = ut.gettimestamp(); var th = this; if (!goods || goods.length == 0) return false; - var user_id = getApp().globalData.userInfo.user_id; + var user_id = getApp().globalData.user_id; if (!user_id) user_id = 0; for (var i in goods) { var val = goods[i]; var item = {}; var prom_id = null; - //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { - - // var url = "/api/weshop/activitylist/getGoodActInfo"; - // var req_data = { - // store_id: os.stoid, - // goodsidlist: val.goods_id, - // is_detail: 1, - // user_id: user_id - // }; - - //获取商品的实际活动 - // await getApp().request.promiseGet(url, { - // data: req_data - // }).then(res => { - // if (res.data.code == 0 && res.data.data && res.data.data.length == 1) { - // item.prom_type = res.data.data[0].prom_type; - // item.prom_id = res.data.data[0].act_id; - // } - // }) - // console.log('val++++++<<<<<', val); + item.goods_name = val.serviceName; item.goods_img = th.data.imghost + val.imgUrl; item.market_price = val.show_price; @@ -532,12 +408,6 @@ Component({ item.sales_sum = val.sales_sum; item.goods_id = val.id; - // item.cardprice1 = val.cardprice1; - // item.cardprice2 = val.cardprice2; - // item.cardprice3 = val.cardprice3; - // item.prom_type = val.prom_type; - // item.prom_id = val.prom_id; - if (val.prom_price) item.prom_price = val.prom_price; if (val.prom_integral) item.prom_integral = val.prom_integral; @@ -547,44 +417,6 @@ Component({ var url = ""; - // switch (prom_type) { - // case 1: - // var user_id = getApp().globalData.user_id; - // if (!user_id) user_id = 0; - // url = "/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id; - // break; - // case 2: - // url = "/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + val.goods_id + "/" + prom_id - // break; - // case 4: - // url = "/api/weshop/integralbuy/get/" + os.stoid + "/" + prom_id; - // break; - // case 6: - // url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; - // break; - // case 8: - // var presell_id = prom_id; - // var url1 = "/api/weshop/marketing/marketingPresellList/list"; - // var rd = { - // store_id: os.stoid, - // presell_id: presell_id, - // goods_id: val.goods_id - // } - // //------获取预售从表---------- - // await getApp().request.promiseGet(url1, { - // data: rd - // }).then(res => { - // if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { - // var arr = res.data.data[0]; - // item.prom_price = arr.luck_goods_price; - // item.sales_sum = arr.buy_goodnum + (arr.virtual_qty ? arr.virtual_qty : 0); - // } - // }) - // break; - // default: - // break - // } - if (url != null && url != '') { await getApp().request.promiseGet(url, {}).then(res => { var prom = null; @@ -627,9 +459,7 @@ Component({ page: th.data.currentPage - 1, }); } - - - // console.log('goods_array0000000000====>>>', th.data.goods_array); + }, diff --git a/components/goods_list/goods_list.js b/components/goods_list/goods_list.js index 5c9ce87..6caf01a 100644 --- a/components/goods_list/goods_list.js +++ b/components/goods_list/goods_list.js @@ -16,21 +16,22 @@ Component({ card_field: "", card_name: "", max_card_field: "", - card_list: null + card_list: null, + is_no_plus: 1, }, properties: { // 这⾥定义了innerText属性,属性值可以在组件使⽤时指定 }, - ready: function () {}, + ready: function () { }, pageLifetimes: { //要处理一下,游客登录后的界面的变化,主要还该是改变会员 show: function () { this.init(); - if(getApp().globalData.login_back==1){ - getApp().globalData.login_back==0; - this.data.curPage=1; - this.setData({ recommend: [] }); - this.get_list(); + if (getApp().globalData.login_back == 1) { + getApp().globalData.login_back == 0; + this.data.curPage = 1; + this.setData({ recommend: [] }); + this.get_list(); } } }, @@ -83,29 +84,30 @@ Component({ }) } - - - + } + }) + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } } }) }, - // get_list: function () { - // var th = this; - // var url = "http://172.20.0.233:8022/api/weshop/display"; - // wx.request({ - // url: url, - // success: function (res) { - // th.setData({ - // recommend: res.data.data.pageData - // }) - // } - // }) - // }, + get_list: function () { var that = this; if (that.data.is_no_more == 0) return false; - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=0; + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; var curPage = that.data.curPage; getApp().request.get('/api/weshop/goods/page?page', { @@ -135,10 +137,10 @@ Component({ //加载完成 if (data.data.pageData) { - for(let i in data.data.pageData){ - let item=data.data.pageData[i]; - if(item.user_price) - item.prom_price=item.user_price; + for (let i in data.data.pageData) { + let item = data.data.pageData[i]; + if (item.user_price) + item.prom_price = item.user_price; } that.setData({ @@ -208,10 +210,10 @@ Component({ }) }, - go_url:function (e) { - var url=e.currentTarget.dataset.url; - getApp().goto(url); - } + go_url: function (e) { + var url = e.currentTarget.dataset.url; + getApp().goto(url); + } }, }) \ No newline at end of file diff --git a/components/goods_list/goods_list.wxml b/components/goods_list/goods_list.wxml index 7675f86..a04bef6 100644 --- a/components/goods_list/goods_list.wxml +++ b/components/goods_list/goods_list.wxml @@ -6,9 +6,9 @@ - + - + @@ -16,25 +16,25 @@ {{item.goods_name}} - - - {{item.prom_integral}}积分 - + - - - - {{item.prom_price}} - - - - - - - {{item.market_price}} - - - - + + + {{item.prom_integral}}积分 + + + + + + {{item.prom_price}} + + + + + + + {{item.market_price}} + + + + @@ -81,7 +81,7 @@ - + @@ -94,16 +94,16 @@ {{item.market_price}} - + - - - {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - - - {{g_filter.get_card_price(item,card_list,1)}} - - + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + + diff --git a/components/serviceCard_list/serviceCard_list.js b/components/serviceCard_list/serviceCard_list.js index d642be6..210b188 100644 --- a/components/serviceCard_list/serviceCard_list.js +++ b/components/serviceCard_list/serviceCard_list.js @@ -90,18 +90,6 @@ Component({ } }) }, - // get_list: function () { - // var th = this; - // var url = "http://172.20.0.233:8022/api/weshop/display"; - // wx.request({ - // url: url, - // success: function (res) { - // th.setData({ - // recommend: res.data.data.pageData - // }) - // } - // }) - // }, get_list: function () { var that = this; if (that.data.is_no_more == 0) return false; @@ -109,18 +97,8 @@ Component({ if(!user_id) user_id=0; var curPage = that.data.curPage; - - // page: curPage, - // pageSize: 6, - // orderField: "sort", - // orderType: 'asc', - // // user_id: user_id, - // // is_mainshow: 1, - // // isonsale: 1, - // // is_on_sale: 1, - // is_recommend: 1, - // store_id: o.stoid, - + + getApp().request.get('/api/weshop/serviceCard/page', { isShowLoading: false, data: { diff --git a/components/timePicker/timePicker.js b/components/timePicker/timePicker.js index 0096d7d..ed02ede 100644 --- a/components/timePicker/timePicker.js +++ b/components/timePicker/timePicker.js @@ -83,14 +83,10 @@ Component({ * 组件的初始数据 */ data: { - // pickerShow:true - // limitStartTime: new Date().getTime()-1000*60*60*24*30, - // limitEndTime: new Date().getTime(), - // yearStart:2000, - // yearEnd:2100 + }, detached: function() { - console.log("dele"); + }, attached: function() {}, ready: function() { @@ -384,11 +380,7 @@ Component({ this.setStartDate(startYear, startMonth, startDay, startHour, startMinute, startSecond); this.setEndDate(endYear, endMonth, endDay, endHour, endMinute, endSecond); - //!!! - // setTimeout(() => { - // this.setStartDate(nowYear, nowMonth, nowDay, nowHour, nowMinute) - // this.setEndDate(nowYear, nowMonth, nowDay, nowHour, nowMinute) - // }, 0); + }, setPickerDateArr(type, year, month, day, hour, minute, second) { let yearIdx = 0; diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index ad7d3e8..532967a 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -107,15 +107,11 @@ Component({ fontcolor:data.fontcolor, is_custum:1 }) - // console.log('abc=======<<<<<', this.data.list); + }, nav_goto:function(e){ - // const data = e.currentTarget.dataset - // this.setData({ - // active: data.index - // }) - // console.log('active***********<<<<<', this.data.active); + var url=e.currentTarget.dataset.url; if(!url) return false; if(url[0]!='/') url='/'+url; @@ -123,18 +119,7 @@ Component({ getApp().goto(url); }, - - // switchTab(e) { - // const data = e.currentTarget.dataset - // const url = data.path - // wx.switchTab({url}) - // this.setData({ - // selected: data.index - // }) - // } - - } diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml index 0c417bb..23f8d7f 100644 --- a/custom-tab-bar/index.wxml +++ b/custom-tab-bar/index.wxml @@ -4,9 +4,6 @@ - - {{cartGoodsNum}} @@ -23,8 +20,7 @@ - + diff --git a/images/gt.png b/images/gt.png index 354851e..5e68248 100644 --- a/images/gt.png +++ b/images/gt.png diff --git a/images/share/ct_num.png b/images/share/ct_num.png index c6e1ac3..e47d23c 100644 --- a/images/share/ct_num.png +++ b/images/share/ct_num.png diff --git a/images/share/default_g_img.gif b/images/share/default_g_img.gif index a5369e2..fd72ed1 100644 --- a/images/share/default_g_img.gif +++ b/images/share/default_g_img.gif diff --git a/images/share/hui_hear_pic.png b/images/share/hui_hear_pic.png index 9ea7b6d..fef442e 100644 --- a/images/share/hui_hear_pic.png +++ b/images/share/hui_hear_pic.png diff --git a/images/share/mackground.png b/images/share/mackground.png index 39396ac..f4baa60 100644 --- a/images/share/mackground.png +++ b/images/share/mackground.png diff --git a/images/share/miao_share.png b/images/share/miao_share.png index 45f6493..1efa17a 100644 --- a/images/share/miao_share.png +++ b/images/share/miao_share.png diff --git a/images/share/q_tj.png b/images/share/q_tj.png index 56136e5..c7eb1ee 100644 --- a/images/share/q_tj.png +++ b/images/share/q_tj.png diff --git a/images/share/s_gou.png b/images/share/s_gou.png index 02a8b0a..7f652c5 100644 --- a/images/share/s_gou.png +++ b/images/share/s_gou.png diff --git a/images/share/share_bg.png b/images/share/share_bg.png index a3177c6..5dc3a68 100644 --- a/images/share/share_bg.png +++ b/images/share/share_bg.png diff --git a/packageA/pages/cart2_ser/cart2_ser.js b/packageA/pages/cart2_ser/cart2_ser.js index 34a44ab..1250ec1 100644 --- a/packageA/pages/cart2_ser/cart2_ser.js +++ b/packageA/pages/cart2_ser/cart2_ser.js @@ -249,6 +249,11 @@ Page({ t.data.data.original_img = oo.imghost + t.data.data.imgUrl; t.data.data['buynum'] = gg.goods_num; t.data.data.shop_price = gd.money; + + if(th.data.postdata.prom_type == 1) { + let postdata = th.data.postdata; + t.data.data.shop_price = postdata.prom_price; + }; th.setData({ bn_goods: t.data.data, @@ -510,6 +515,12 @@ Page({ // 'price': th.data.formData.order_amount, 'pickup_id': gg.pick_id, 'pickup_keyid': gg.keyid, + 'prom_type': this.data.postdata.prom_type, //促销活动类型 + 'prom_id': this.data.postdata.prom_id, //促销活动id + }; + + if(this.data.postdata.prom_type == 1) { + goods.price = this.data.postdata.prom_price; }; //--导购分享过来的id-- @@ -525,6 +536,7 @@ Page({ } }) } + console.log('goooooooooooooooooods', goods); item.list.push(goods); } diff --git a/packageA/pages/distribution/goods/goods.js b/packageA/pages/distribution/goods/goods.js index 025012c..f6d3451 100644 --- a/packageA/pages/distribution/goods/goods.js +++ b/packageA/pages/distribution/goods/goods.js @@ -14,22 +14,19 @@ Page({ inputVal: '',//记录搜索输入框的内容 isSort: false,//控制排序开关状态,true开启排序 isDescending: false, //isDescending降序,ascending升序 - - tabArr: [], currentTabIndex: 0, isShowRow: false,//控制视图切换状态 isHiddenDropdown: true,//控制筛选下拉菜单显隐 - list: null, isLoading: false, // 检测是否已经发送请求,防止重复发送请求 noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 pageNum: 1, // 当前页数 - isCheckAll: false, //记录是否全选 currentQuery: { store_id: app.globalData.setting.stoid, }, + is_no_plus:1, default_img: '/miniapp/images/default_g_img.gif', }, @@ -67,6 +64,22 @@ Page({ options, tabArr, }); + + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + self.setData({ is_no_plus: 0 }) + } + } + } + } + }) diff --git a/packageA/pages/distribution/goods/goods.wxml b/packageA/pages/distribution/goods/goods.wxml index bc6344e..61c2412 100644 --- a/packageA/pages/distribution/goods/goods.wxml +++ b/packageA/pages/distribution/goods/goods.wxml @@ -5,12 +5,12 @@ - + 筛选 - + - - + + - + - + + + {{item.goods_name}} - - {{item.prom_integral}}积分 - + - - - - {{item.prom_price}} - - - - - - - {{item.market_price}} - - + + {{item.prom_integral}}积分 + + + + + + {{item.prom_price}} + + + + + + + {{item.market_price}} + + - - - - - - - - - - - {{filter.toFix(item[card_field],2)}} - - - {{card_name}} - - - - - - - - {{item.market_price}} - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - {{item.market_price}} - - - - - - - {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - - - {{g_filter.get_card_price(item,card_list,1)}} - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + + + {{card_name}} + + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + + + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + 分成金额:{{filter.toFix(item.commission, 2)}} - + - - + + - + {{item.goods_name}} - + - - {{item.prom_integral}}积分 - + - - - - {{item.prom_price}} - - - - - - - {{item.market_price}} - - + + {{item.prom_integral}}积分 + + + + + + {{item.prom_price}} + + + + + + + {{item.market_price}} + + - - - - - - - - - - - {{filter.toFix(item[card_field],2)}} - - - {{card_name}} - - - - - - - - {{item.market_price}} - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - {{item.market_price}} - - - - - - - {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - - + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + + + {{card_name}} + + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + + {{g_filter.get_card_price(item,card_list,1)}} - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + 分成金额:{{filter.toFix(item.commission, 2)}} @@ -353,25 +357,17 @@ - + - - - - - - + 一键上架 一键下架 - - - - + \ No newline at end of file diff --git a/packageA/pages/distribution/shop/shop.js b/packageA/pages/distribution/shop/shop.js index 951e5b5..20860ff 100644 --- a/packageA/pages/distribution/shop/shop.js +++ b/packageA/pages/distribution/shop/shop.js @@ -17,26 +17,21 @@ Page({ isDescending: false, //isDescending降序,ascending升序 imghost: '', url: os.imghost, - tabArr: ['最新', '销量', '评论', '价格'], currentTabIndex: 0, isShowRow: false,//控制视图切换状态 isHiddenDropdown: true,//控制筛选下拉菜单显隐 - list: [], isLoading: false, // 检测是否已经发送请求,防止重复发送请求 noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 pageNum: 1, // 当前页数 - - rank_switch: false, card_field: "", card_name: "", max_card_field: "", card_list: null, - isAll: true, - + is_no_plus:1, default_img: '/miniapp/images/default_g_img.gif', }, @@ -213,6 +208,21 @@ Page({ }) } }) + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) } if (app.globalData.key_word) { diff --git a/packageA/pages/distribution/shop/shop.wxml b/packageA/pages/distribution/shop/shop.wxml index 419c52f..e790000 100644 --- a/packageA/pages/distribution/shop/shop.wxml +++ b/packageA/pages/distribution/shop/shop.wxml @@ -1,365 +1,365 @@ - - - - - - - - - - - - {{userInfo2.nickname}} - - - - - - - {{userInfo.nickname}} - - - - - {{filter.show_default(total)}} - 全部商品 - - - {{filter.show_default(newListTotal)}} - 新品 - - - - - - 会员中心 - - - - - - - - - - - - - 搜索 - - - - - - {{item}} - - - {{item}} - - - - - - - - - - - - - - - - - {{item.goods_name}} - - - - - {{item.prom_integral}} - 积分 - - + - - - - {{item.prom_price}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - - - - {{filter.toFix(item[card_field],2)}} - - - {{card_name}} - - - - - - - - {{item.market_price}} - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - {{item.market_price}} - - - - - - - {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - - - {{g_filter.get_card_price(item,card_list,1)}} - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - - - - - - {{item.goods_name}} - - - - - {{item.prom_integral}} - 积分 - - + - - - - {{item.prom_price}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - - - - {{filter.toFix(item[card_field],2)}} - - - {{card_name}} - - - - - - - - {{item.market_price}} - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - {{item.market_price}} - - - - - - - - {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - - - - {{g_filter.get_card_price(item,card_list,1)}} - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - 分成金额: - {{filter.toFix(item.commission,2)}} - - - - - - - + + + + + + + + + + + + {{userInfo2.nickname}} + + + + + + + {{userInfo.nickname}} + + + + + {{filter.show_default(total)}} + 全部商品 + + + {{filter.show_default(newListTotal)}} + 新品 + + + + + + 会员中心 + + + + + + + + + + + + + 搜索 + + + + + + {{item}} + + + {{item}} + + + + + + + + + + + + + + + + + {{item.goods_name}} + + + + + {{item.prom_integral}} + 积分 + + + + + + + {{item.prom_price}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + + + {{card_name}} + + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + + + + + + {{item.goods_name}} + + + + + {{item.prom_integral}} + 积分 + + + + + + + {{item.prom_price}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + + + {{card_name}} + + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + + + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + 分成金额: + {{filter.toFix(item.commission,2)}} + + + + + + + \ No newline at end of file diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 495e6ba..34fb2fe 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -113,7 +113,7 @@ Page({ is_sec_mend: 0, sto_sele_name: "", //选中的门店名称 sto_sele_id: "", //选中的门店id - sto_sele_keyid:'', //选中的门店线下 + sto_sele_keyid:'', //选中的门店线下 sto_sele_distr: "", //选择的门店的配送方式 is_show_sto_cat: 1, //是否显示门店分类 only_pk: null, @@ -205,14 +205,18 @@ Page({ hui_condition:null, sto_sele_name_1:'',//分享的门店名称 + // 秒杀 + prom_st: 1, + prom_r_null: 0, }, //------初始化加载---------- onLoad: function(t) { - self = this; - this.data.options = t; // { goods_id: ...} - + + this.setData({ + options: t, + }); var ee = this, that = ee, @@ -265,11 +269,11 @@ Page({ ee.setData({ gid: gid}); - if(first_leader){ + if(first_leader) { getApp().globalData.first_leader=first_leader; //调用接口判断是不是会员 getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{ - if(res.data.code==0){ + if(res.data.code==0) { getApp().globalData.guide_id=res.data.data.id; } }) @@ -377,7 +381,7 @@ Page({ var ser_card=th.data.data; //--如果默认门店不在等级卡的默认们店以内 if(ser_card.storageId!=null && ser_card.storageId!="" && ser_card.storageId.indexOf(ee.keyid)==-1){ - ee.is_no_dis=1; + ee.is_no_dis=1; } var appd=getApp().globalData; @@ -446,6 +450,25 @@ Page({ }); }, + + + onReady() { + + setTimeout(()=>{ + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => { + // console.log('node@@@@@@@', res); + if(res.length != 0) { + this.setData({ + showFold: res[0].height < res[1].height, + }); + }; + + }).exec(); + }, 1000); + + }, + + //------------程序初始化入口------------- async init(gid) { var ee = this, @@ -486,6 +509,59 @@ Page({ // }) + // ----> 秒杀 + let prom_type = this.data.options.prom_type; + + let goods_id = this.data.options.goods_id; + if(!goods_id) goods_id = this.data.data.goods_id; + + if(prom_type) { // 进入商品详情页地址传参有带goods_id、prom_type、prom_id参数, 即从秒杀入口进入 + let prom_id = this.data.options.prom_id; + this.check_prom(goods_id, prom_type, prom_id); + } else { // 从非秒杀入口进入,地址不带prom_type、prom_id参数 + getApp().request.promiseGet('/api/weshop/activitylist/getGoodActInfo', { + data: { + store_id: os.stoid, + goodsidlist: goods_id, + is_detail: 1, + goods_type: 1, + user_id: oo.user_id, + } + }).then(res => { + if (res.data.code == 0) { + let result = res.data.data; + let resLength = result.length; + if(resLength == 1) { // 如果数组长度为1,则直接显示当前活动 + let goods_id = this.data.options.goods_id; + let prom_type = result[0].prom_type; + let prom_id = result[0].act_id; + this.setData({ + 'options.prom_type': prom_type, + }); + this.check_prom(goods_id, prom_type, prom_id); + } else if(resLength > 1) { //如果数组长度大于1,表示当前商品参加多个活动,以列表形式显示多活动 + this.setData({ + actList: res.data.data, + }); + }; + + // console.log('!!!!!!~~~~~~~~~prom~~~~~~~~~~!!!!!!'); + + // this.setData({ + // prom, + // }); + + }; + }); + }; + // <---- 秒杀 + + + + + + + //------是否收藏---------- await getApp().request.promiseGet("/api/weshop/goodscollect/page", { data: { @@ -509,8 +585,6 @@ Page({ store_id: os.stoid, service_id: gid }, - //failRollback: !0, - }).then(res => { console.log('get评价统计数量', res.data.data); var t = res; @@ -530,7 +604,7 @@ Page({ categories3 = dd; } - }) + }); //----获取详情页的评价---- await getApp().request.promiseGet("/api/weshop/serviceComment/pageComment", { @@ -545,7 +619,7 @@ Page({ }).then(res => { console.log('get详情页评价', res.data.data); fir_com = res.data.data.pageData; - }) + }); if (fir_com) { for (var ind in fir_com) { @@ -553,7 +627,7 @@ Page({ if (fir_com[ind].img) fir_com[ind].img = ut.unserialize(fir_com[ind].img); if (fir_com[ind].weapp_img) fir_com[ind].weapp_img = JSON.parse(fir_com[ind].weapp_img); } - } + }; this.getTaohe(); @@ -592,6 +666,11 @@ Page({ var ee = this,gid = this.data.gid, i = getApp().request; this.data.is_timer = 1; this.wait_for_store_config(); + + + + + i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, { failRollback: !0, @@ -668,6 +747,8 @@ Page({ this.data.enterAddressPage && (this.data.enterAddressPage = !1); this.get_sto(); + + }, enterAddress: function() { @@ -681,6 +762,7 @@ Page({ clearInterval(i); } }, + onHide: function() { this.data.is_timer = 0; for(var i = 1; i < 100; i++) { @@ -694,11 +776,12 @@ Page({ activeCategoryId: e }), 1 == e ? this.tabGoodsContent() : 2 == e && this.tabComment(); }, - tabClick2: function(t) { - this.setData({ - activeCategoryId2: t.currentTarget.id - }); - }, + + // tabClick2: function(t) { + // this.setData({ + // activeCategoryId2: t.currentTarget.id + // }); + // }, tabClick3: function(t) { var e = this; @@ -712,11 +795,11 @@ Page({ } }, - doScrollTop: function() { - wx.pageScrollTo({ - scrollTop: 0 - }); - }, + // doScrollTop: function() { + // wx.pageScrollTo({ + // scrollTop: 0 + // }); + // }, tabComment: function() { this.setData({ @@ -727,7 +810,7 @@ Page({ //商品详情的时候调用 tabGoodsContent: function() { var th = this, - i = getApp().request; + i = getApp().request; this.setData({ activeCategoryId: 1 }); @@ -741,7 +824,7 @@ Page({ var action= t.currentTarget.dataset.action; if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind; - th.setData({ + th.setData({ open_ind_store: ind }); @@ -762,8 +845,16 @@ Page({ newd['pick_name'] = th.data.sto_sele_name; newd['guide_id'] = getApp().globalData.guide_id; newd['guide_type']=0; + + if(this.data.prom_type && this.data.prom_type == 1) { + newd['prom_type'] = this.data.prom_type; + newd['prom_id'] = this.data.prom_id; + newd['prom_price'] = this.data.prom_price; + } + + // console.log('newd++++++++', newd); th.buyNow(newd); - }else{ + } else { var newd = { service_id: th.data.data.id, @@ -873,7 +964,8 @@ Page({ }, openSpecModel: function(t) { - var th=this; + // console.log('****ttttttt***', t); + var th=this; var open_store = t.currentTarget.dataset.ind; this.setData({ store: 0, @@ -2741,7 +2833,318 @@ Page({ }; }; }); - } + }, + + + + + //---小于10的格式化函数---- + // timeFormat(param) { + // return param < 10 ? '0' + param : param; + // }, + + //----倒计时函数----- + countDown(time, prom_st) { + if (!this.data.is_timer) return false; + var th = this; + // 获取当前时间,同时得到活动结束时间数组 + var endTime = time; + var newTime = ut.gettimestamp(); + // 对结束时间进行处理渲染到页面 + var obj = null; + // 如果活动未结束,对时间进行处理 + if (endTime - newTime > 0) { + var time = (endTime - newTime); + // 获取天、时、分、秒 + var day = parseInt(time / (60 * 60 * 24)); + var hou = parseInt(time % (60 * 60 * 24) / 3600); + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + obj = { + day: this.timeFormat(day), + hou: this.timeFormat(hou), + min: this.timeFormat(min), + sec: this.timeFormat(sec) + } + } else { + if (th.data.prom_st == 0) { + //var endTime2 = new Date(th.data.prom_end_time).getTime(); + var endTime2 = th.data.prom_act.end_time; + th.setData({ + prom_time_text: '距结束还剩:', + prom_st: 1 + }) + setTimeout(function () { + th.countDown(endTime2) + }, 1000); + return false; + + } else { + //活动已结束,全部设置为'00' + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' + } + th.setData({ + prom_time_text: '活动已经结束:', + prom_st: 3 + }) + th.setData({ + djs: obj + }); + return false; + } + } + + th.setData({ + djs: obj + }); + setTimeout(function () { + th.countDown(endTime) + }, 1000); + }, + + + get_normal(gid) { + this.setData({ + prom_type: 0, + isshow: 1, + }); + // this.get_sku(os.stoid, this.data.data, gid); + // this.get_sto(); + // this.check_is_youhui(gid, 1); + this.data.is_normal = 1; + }, + + + + + //--------检查是否活动,活动是否开始,或者是否结束------- + async check_prom(gid, prom_type, prom_id) { + console.log('check_prom'); + var ee = this, th = ee; + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; + + // if (prom_type == 3 || prom_type == 0 || prom_type == 5 || prom_type == 7 || prom_type == 9 || prom_type == 10) { + // this.setData({ + // prom_type: 0, isshow: 1, + // }); + // return false; + // } + + + + // if (prom_type == 1 && prom_id == 0) { + // this.setData({ + // prom_type: 0, isshow: 1, + // }); + + // //获取门店 + // this.get_sto(); + // this.get_sku(o.stoid, this.data.data, gid); + // this.check_has_flash(); + // this.data.is_normal = 1; + // this.check_is_youhui(gid, 1); + // return false; + // } + + //if (prom_type != 3 && prom_type!=0){ + //---判断秒杀---- + if (prom_type == 1 && prom_id > 0) { + //-------判断活动是否抢光--------- + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { + 1: 1 + }).then(res => { + var em = res; + if (res.data.code == 0) { + // console.log('!!!!!!res!!!!', res); + if (res.data.data <= 0) ee.setData({ + prom_r_null: 1 + }); + //拿取价格并且判断时间-- + getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, { + success: function (t) { + // console.log('!!!!!!t!!!!', t); + if (t.data.code != 0) { + ee.get_normal(gid); + return false; + } + //----已经结束----- + if (t.data.data.is_end == 1) { + ee.get_normal(gid); + return false; + } + //----已经过期----- + var now = ut.gettimestamp(); + if (t.data.data.end_time < now) { + ee.get_normal(gid); + return false; + } + /*-- 还没有开始预热的也不显示 --*/ + if (t.data.data.show_time > now) { + ee.get_normal(gid); + return false; + } + + var t_gd = ee.data.data; + var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss"); + var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); + + ee.setData({ + 'data.shop_price': t.data.data.user_price, + prom_price: t.data.data.user_price, + prom_type: 1, + prom_id: prom_id, + prom_buy_limit: t.data.data.buy_limit, + prom_act: t.data.data, + prom_end_time: prom_end_time, + prom_start_time: prom_start_time, + isshow: 1, + }); + + ee.get_sto(); + var newTime = ut.gettimestamp(); + var endTime2 = t.data.data.end_time; + var endTime1 = t.data.data.start_time; + if (endTime1 > newTime) { + ee.setData({ + prom_time_text: '距秒杀开始还有', + prom_st: 0, + }) + ee.countDown(endTime1, 0); + } else { + if (endTime2 > newTime) { + ee.setData({ + prom_time_text: '距秒杀结束还有', + prom_st: 1 + }) + ee.countDown(endTime2); + } + } + + //如果是进行中的话 + // if (endTime1 < newTime) { + // //-- 获取秒杀活动的多少规格 -- + // ee.get_more_flahs(function (list) { + // if (list && list.length > 1) { + + // var n_item = list[0]; + // var ind = list.findIndex(function (ele) { + // return ele.goods_id == ee.data.data.goods_id; + // }) + // if (ind < 0) return false; + // if (ind > 0) { + // n_item = JSON.parse(JSON.stringify(list[ind])); + // list.splice(ind, 1); + // list.unshift(n_item); + // } + + // ee.data.sele_g.viplimited = n_item.viplimited; + // ee.data.data.viplimited = n_item.viplimited; + + // var gb = 1; + // //-- 显示多规格 -- + // for (let i in list) { + // let item = list[i]; + // var gg = ""; + // if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; + // if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; + + // if (item.goods_spec != "" && item.goods_color != "") { + // gg = item.goods_spec + "/" + item.goods_color; + // } else if (item.goods_spec != "" || item.goods_color != "") { + // gg = item.goods_spec + item.goods_color; + // } else { + // gg = "规格" + gb; + // gb++; + // } + // item.gg = gg; + // item.prom_id = item.prom_id; + // item.prom_type = 1; + // } + + // ee.setData({ + // sku_g: list, + // }); + + // } + // }) + // } + + } + }); + } + }) + } + + }, + + + + viewFlash(e) { + let prom_type = e.currentTarget.dataset.promtype; + let prom_id = e.currentTarget.dataset.promid; + let goods_id = this.data.data.goods_id; + let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`; + // console.log('url~~~~', url); + getApp().goto(url); + }, + + + + + //-- 检验商品的活动情况 -- + check_gd_prom_new: function (func) { + var th = this; + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; + + var url = '/api/weshop/activitylist/listGoodActInfo2'; + var req_d = { + "store_id": os.stoid, + "goods_id": this.data.gid, + "user_id": user_id, + } + getApp().request.get(url, { + data: req_d, + success: function (e) { + if (e.data.code == 0 && e.data.data && e.data.data.length > 0) { + var arr = e.data.data; + var arr2 = arr.filter(function (e) { + return e.s_time < ut.gettimestamp(); + }) + //-- 如果只有一个活动的话 -- + if (arr.length == 1) { + th.data.prom_type = arr[0].prom_type; + th.data.prom_id = arr[0].act_id; + } + //-- 如果只有一个进行中的活动的话 -- + else if (arr2.length == 1) { + th.data.prom_type = arr2[0].prom_type; + th.data.prom_id = arr2[0].act_id; + } + } + //-- 调用回调 -- + func(); + } + }); + }, + + + + + + + + + + + + + diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml index 231982d..1212320 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/goodsInfo/goodsInfo.wxml @@ -51,6 +51,7 @@ + @@ -63,6 +64,30 @@ + + + + + + + + + + 距活动开始还有 + 距活动结束还有 + + + {{djs.day}} + + + {{djs.hou}} + + {{djs.min}} + + {{djs.sec}} + + + @@ -73,6 +98,9 @@ + + + {{filters.toFix(data.shop_price,2)}} {{data.goods_name}} @@ -124,18 +152,54 @@ - - + + + + + + + 秒杀{{index+1}} + + + + + + + {{item.act_name}} + + + + + + + + + + + + + - - {{store_config.service_bz}} - - - - - + + {{store_config.service_bz}} + {{store_config.service_bz}} + + + + + @@ -199,7 +263,7 @@ - 商品详情 + 卡项详情 @@ -238,7 +302,7 @@ - + @@ -284,7 +348,7 @@ diff --git a/packageA/pages/goodsInfo/goodsInfo.wxss b/packageA/pages/goodsInfo/goodsInfo.wxss index 500f8d6..49b3695 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxss +++ b/packageA/pages/goodsInfo/goodsInfo.wxss @@ -1025,25 +1025,37 @@ left:31rpx;} .bz_view{ /* height:100rpx; padding: 0 34rpx 0 13rpx; */ color: #333; font-size: 28rpx; padding: 20rpx 20rpx 20rpx 10rpx; /* border-bottom: 3rpx solid #eee; */ /* border-top: 3rpx solid #eee; */} - .bz_view view{ width: 460rpx; /* max-height: 70rpx; */ /* overflow: hidden; */} + .bz_view view{ width: 520rpx; /* max-height: 70rpx; */ /* overflow: hidden; */} .bb_view{ display: flex;align-items: center;justify-content: space-between; padding: 20rpx; color: #333; font-size: 30rpx; /* height: 104rpx; line-height: 104rpx; overflow: hidden; padding-right:26rpx */ } .red_bb{ color: #d70026; /* min-width:158rpx;width: auto; */} -.bg_jj{ width: 14rpx; height:14rpx; - border-top: 2rpx solid #d70026; - border-right: 2rpx solid #d70026; - transform: rotate(45deg);display:inline-block; - margin-bottom:3rpx; + +.bg_jj { + width: 14rpx; + height: 14rpx; + border-top: 2rpx solid #d70026; + border-right: 2rpx solid #d70026; + transform: rotateZ(45deg); + display: inline-block; + margin-bottom: 3rpx; +} + +.bg_jj.down { + transform: rotateZ(135deg); +} + +.bg_jj.up { + transform: rotateZ(-45deg); + margin-top: 6rpx; } -.bg_jj.down1{transform: rotate(135deg);} .bz-content { - flex-grow: 1; - text-align: justify; - padding: 0 30rpx 0 20rpx; + padding: 0 0 0 20rpx; } + + /* 顶部边框 */ .topframe{ width: 100%; @@ -2845,7 +2857,8 @@ button.custom-service::after{ width: auto !important; position: absolute; right: 0; - top: 10rpx; + top: 50%; + transform: translateY(-50%); } .stock { @@ -2907,3 +2920,51 @@ button.custom-service::after{ .del { text-decoration: line-through; } + + + + +.tick { + position: relative; +} + +.tick:before { + content: ''; + display: inline-block; + vertical-align: middle; + margin-top: -4rpx; + margin-right: 12rpx; + width: 22rpx; + height: 22rpx; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAMAAADzapwJAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABCUExURUdwTPInDPInDPgoDfMnDPYqEvInDPInDPInDP87NPUoDv8vEvMoDPInDPIoDPMnDvInDPInDPInDPIoDPQoDfInDEON4KMAAAAVdFJOUwD45yawG4zz3gQ0DmLOfECQZpPlS54kMQ4AAAC0SURBVBjTbZFREoMgDERDS0xQQNHu/a/alEGtaIYfHrBhs0S1pujVifo40VkhC+BUHSDzQTlBhjHY8bjogXmDZ+orJKwXwMUeUoa/0PeGbH8Q4Y5CJopYOjosiOQxdpRGk1UXOkrBKdkimtN8UrKrJBVXdzsllSYSjR/0J9JaGn81WluWtonYKQ0op51P3M2L2bmZN9n8MKoVqTph/RsseyjfYxAkfgot/82CpuJVLOLSIv4Cd5AJ37BgpFwAAAAASUVORK5CYII=) no-repeat; + background-size: 22rpx auto; +} + +.details::after { + content: ''; + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin: auto; + display: inline-block; + width: 40rpx; + height: 40rpx; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAVUExURUdwTIyMjCYmJiYmJi0tLY+PjyYmJidnOsIAAAAGdFJOUwDt6aYcSSEXj/YAAAA8SURBVCjPY2AYBTQBLEbKDhiCTmlpKggeq2AAiDJLS0tGcBkFBUActbS0JAY4F6sgVu1YLcLnpFFAFQAATwgLKVhjC9UAAAAASUVORK5CYII=); + background-repeat: no-repeat; + background-size: 40rpx auto; +} + +.lh2 { + line-height: 2; +} + +.huise { + background: gray +} + +.hideArea { + position: absolute; + left: -1000px; + top: -1000px; +} diff --git a/packageA/pages/jfbuy/jfbuy.wxss b/packageA/pages/jfbuy/jfbuy.wxss index d7d08bc..e30a18b 100644 --- a/packageA/pages/jfbuy/jfbuy.wxss +++ b/packageA/pages/jfbuy/jfbuy.wxss @@ -130,7 +130,7 @@ page { .img-container { background-color: #f0f0f0; width: 280rpx; - height: 248rpx; + height: 280rpx; display: flex; align-items: center; justify-content: center; diff --git a/packageA/pages/liveStream/liveStream.js b/packageA/pages/liveStream/liveStream.js index 4027ba0..b9ced4c 100644 --- a/packageA/pages/liveStream/liveStream.js +++ b/packageA/pages/liveStream/liveStream.js @@ -208,14 +208,14 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - self = this; - // console.log('ppppp',this.pageTotal(4, 10)); + getApp().is_Single_page(this,function(){ + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 + this.setData({ + userInfo: data, + }); + }); + }) - app.isLogin().then(function(data) {//进入页面前已经授权登录成功 - self.setData({ - userInfo: data, - }); - }); }, /** diff --git a/packageA/pages/quan_list/quan_list.wxml b/packageA/pages/quan_list/quan_list.wxml index f702d52..50866d9 100644 --- a/packageA/pages/quan_list/quan_list.wxml +++ b/packageA/pages/quan_list/quan_list.wxml @@ -4,44 +4,46 @@ - + - + - {{filters.toFix(item.money,2)}} - 满{{filters.toFix(item.condition,2)}}可用 + {{filters.toFix(item.money,2)}} + 满{{filters.toFix(item.condition,2)}}可用 - + - {{item.name}} + {{item.name}} - {{item.coupon_remark}} - 所有门店通用 - 有效期 - {{filters.format_time(getcurday+3600*24*item.startdays)}} - {{filters.format_time(item.use_start_time)}}至 - {{filters.format_time(item.use_end_time)}}不限 - - 有效期 {{filters.format_time(getcurday+3600*24*item.startdays)}} + {{item.coupon_remark}} + 所有门店通用 + 有效期 + {{filters.format_time(getcurday+3600*24*item.startdays)}} + {{filters.format_time(item.use_start_time)}} + 至 + {{filters.format_time(item.use_end_time)}}不限 + + 有效期 + {{filters.format_time(getcurday+3600*24*item.startdays)}} {{filters.format_time(getcurday)}} 至 - {{filters.format_time(getcurday+3600*24*item.days)}} - 不限 - - - 每人限领:{{item.everyone_num}}不限 - - + {{filters.format_time(getcurday+3600*24*item.days+3600*24*item.startdays)}} + 不限 + + + 每人限领:{{item.everyone_num}}不限 + + 已领取 立即领取 - + - + @@ -58,5 +60,4 @@ - - + \ No newline at end of file diff --git a/packageA/pages/quan_pro/quan_pro.wxml b/packageA/pages/quan_pro/quan_pro.wxml index 0c6bfa6..e1e45dc 100644 --- a/packageA/pages/quan_pro/quan_pro.wxml +++ b/packageA/pages/quan_pro/quan_pro.wxml @@ -40,7 +40,7 @@ 有效期 {{filters.format_time(getcurday+3600*24*q_data.startdays)}} {{filters.format_time(getcurday)}}至 - {{filters.format_time(getcurday+3600*24*q_data.days)}}不限 + {{filters.format_time(getcurday+3600*24*q_data.days+3600*24*q_data.startdays)}}不限 diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.js b/packageB/pages/luckactivity/luckinfo/luckinfo.js index 2acc288..f9370d2 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.js +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.js @@ -1379,35 +1379,6 @@ Page({ }; }, 500); }; - // if(this.data.isImgOk) { - // setTimeout(function() { - // wx.hideLoading(); - // self.setData({ - // myimg: self.data.imgPath, - // hiddenCanvas: true, - // showMask: true, - // showPoster: true, - // }); - // }, 300); - - // } else { - // wx.showToast({ - // title: '生成失败,请重新点击', - // icon: 'none', - // }); - // }; - - // setTimeout(function() { - // // if(self.data.myimg) { - // if(self.data.imgPath) { - // wx.hideLoading(); - - // } else { - // console.log('没有生成图片!!!!!!', self.data.imgPath); - // }; - - // // } - // }, 300); }, closePoster() { diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js index 47df26f..44dbb66 100644 --- a/packageB/pages/zuhegou/index/index.js +++ b/packageB/pages/zuhegou/index/index.js @@ -11,80 +11,80 @@ let imgDraw = { "height": "843px", "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg", "views": [{ // 头像 - "type": "image", - "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", - "css": { - "width": "100px", - "height": "100px", - "top": "20px", - "left": "275px", - "borderRadius": "100px", - "mode": "scaleToFill", - "borderWidth": "2px", - "borderColor": "#fff", - } - }, - { //昵称 - "type": "text", - "text": "我是店铺名", - "css": { - "width": "650px", - "color": "#fff", - "top": "136px", - // "left": "137px", - "textAlign": "center", - "fontSize": "26px", - "maxLines": "1", - } - }, - { //10元任选3件 - "type": "text", - "text": "10元3件", - "css": { - "color": "#fff", - "width": "650px", - "top": "270px", - "fontSize": "70px", - "maxLines": "1", - "textAlign": "center", - "fontWeight": "bold", - } - }, - { //活动时间 - "type": "text", - "text": "活动时间:2021.07.06 - 2021.07.08", - "css": { - "color": "#333", - "width": "650px", - "top": "440px", - "fontSize": "26px", - "fontWeight": "normal", - "maxLines": "1", - "textAlign": "center" - } - }, - { // 码 - "type": "image", - "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", - "css": { - "color": "#000", - "width": "200px", - "height": "200px", - "top": "525px", - "left": "225px", - } - }, - { // 扫码提示 - "type": "text", - "text": "长按扫码即可参与活动", - "css": { - "color": "#666", - "width": "650px", - "top": "750px", - "fontSize": "26px", - "textAlign": "center" - } - }, + "type": "image", + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", + "css": { + "width": "100px", + "height": "100px", + "top": "20px", + "left": "275px", + "borderRadius": "100px", + "mode": "scaleToFill", + "borderWidth": "2px", + "borderColor": "#fff", + } + }, + { //昵称 + "type": "text", + "text": "我是店铺名", + "css": { + "width": "650px", + "color": "#fff", + "top": "136px", + // "left": "137px", + "textAlign": "center", + "fontSize": "26px", + "maxLines": "1", + } + }, + { //10元任选3件 + "type": "text", + "text": "10元3件", + "css": { + "color": "#fff", + "width": "650px", + "top": "270px", + "fontSize": "70px", + "maxLines": "1", + "textAlign": "center", + "fontWeight": "bold", + } + }, + { //活动时间 + "type": "text", + "text": "活动时间:2021.07.06 - 2021.07.08", + "css": { + "color": "#333", + "width": "650px", + "top": "440px", + "fontSize": "26px", + "fontWeight": "normal", + "maxLines": "1", + "textAlign": "center" + } + }, + { // 码 + "type": "image", + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", + "css": { + "color": "#000", + "width": "200px", + "height": "200px", + "top": "525px", + "left": "225px", + } + }, + { // 扫码提示 + "type": "text", + "text": "长按扫码即可参与活动", + "css": { + "color": "#666", + "width": "650px", + "top": "750px", + "fontSize": "26px", + "textAlign": "center" + } + }, ] }; @@ -123,6 +123,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + console.log(options, 111); self = this; var the_id = options.id; @@ -153,226 +154,224 @@ Page({ } }) } - - //如果有会员的时候 - var userInfo = getApp().globalData.userInfo; - if (!userInfo) { - getApp().goto("/pages/togoin/togoin"); - return false; - } }, /** * 生命周期函数--监听页面显示 */ onShow: function () { - var th = this, - that = this, - ee = this; - this.data.is_timer = 1; - if (this.data.act) this.countDown(); - //如果有会员的时候 - var userInfo = getApp().globalData.userInfo; - if (userInfo) { - if (!th.data.is_get_act) { - //获取活动信息 - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id; - getApp().request.get(url, { - success: function (e) { - th.data.is_get_act = 1; - if (e.data.code == 0 && e.data.data) { - self.setData({ - act: e.data.data - }); - if (e.data.data.is_show != 1) { - th.setData({ - error: '活动未开启' - }); - return false; - } - if (ut.gettimestamp() < e.data.data.start_time) { - th.setData({ - error: '活动还未开始' + getApp().is_Single_page(this, function () { + var th = this, + that = this, + ee = this; + this.data.is_timer = 1; + if (this.data.act) this.countDown(); + //如果有会员的时候 + var userInfo = getApp().globalData.userInfo; + if (userInfo) { + if (!th.data.is_get_act) { + //获取活动信息 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id; + getApp().request.get(url, { + success: function (e) { + th.data.is_get_act = 1; + if (e.data.code == 0 && e.data.data) { + self.setData({ + act: e.data.data }); - return false; - } - if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { - //-- 获取商品列表 -- - self.get_list(); - self.countDown(); + if (e.data.data.is_show != 1) { + th.setData({ + error: '活动未开启' + }); + return false; + } + if (ut.gettimestamp() < e.data.data.start_time) { + th.setData({ + error: '活动还未开始' + }); + return false; + } + if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { + //-- 获取商品列表 -- + self.get_list(); + self.countDown(); + } else { + th.setData({ + error: '活动已经过期' + }); + return false; + } } else { + th.data.is_get_act = 0; th.setData({ - error: '活动已经过期' + error: e.data.msg }); return false; } - } else { - th.data.is_get_act = 0; - th.setData({ - error: e.data.msg - }); - return false; } - } - }); - } - - //等待活动值 - this.waitfor2(10, 'list', function () { - if (!th.data.list) return false; - if (ut.gettimestamp() < th.data.act.start_time) { - return false; - } - if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) { - return false; + }); } - //获取头像的分享 - th.get_head_temp(function () { - var txt = th.data.act.zhprice + "元" + th.data.act.zhbuyqty + "件"; - imgDraw.views[0].url = th.data.share_head; - imgDraw.views[1].text = userInfo.nickname; - imgDraw.views[2].text = txt; - - var start = ut.formar_no_full(th.data.act.start_time, '.'); - var end = ut.formar_no_full(th.data.act.end_time, '.'); - txt = "活动时间:" + start + " - " + end; - imgDraw.views[3].text = txt; - - var scene = th.data.id + ""; - var user_id = getApp().globalData.user_id; - scene += "_" + user_id; - ///二微码 - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + - os.stoid + "?sceneValue=" + scene + "&pageValue=packageB/pages/zuhegou/index/index"; - wx.getImageInfo({ - src: path3, - success: function (res) { - var vpath = res.path; - imgDraw.views[4].url = vpath; - th.setData({ - imgDraw: imgDraw - }) - } - }) - }) - //获取用户的默认门店 - getApp().get_user_store(function (e) { - if (!e) { - th.data.fir_def_store = {}; //赋值空对象 + //等待活动值 + this.waitfor2(10, 'list', function () { + if (!th.data.list) return false; + if (ut.gettimestamp() < th.data.act.start_time) { + return false; + } + if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) { return false; } + //获取头像的分享 + th.get_head_temp(function () { + var txt = th.data.act.zhprice + "元" + th.data.act.zhbuyqty + "件"; + imgDraw.views[0].url = th.data.share_head; + imgDraw.views[1].text = userInfo.nickname; + imgDraw.views[2].text = txt; + + var start = ut.formar_no_full(th.data.act.start_time, '.'); + var end = ut.formar_no_full(th.data.act.end_time, '.'); + txt = "活动时间:" + start + " - " + end; + imgDraw.views[3].text = txt; + + var scene = th.data.id + ""; + var user_id = getApp().globalData.user_id; + scene += "_" + user_id; + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=packageB/pages/zuhegou/index/index"; + wx.getImageInfo({ + src: path3, + success: function (res) { + var vpath = res.path; + imgDraw.views[4].url = vpath; + th.setData({ + imgDraw: imgDraw + }) + } + }) + }) + //获取用户的默认门店 + getApp().get_user_store(function (e) { + if (!e) { + th.data.fir_def_store = {}; //赋值空对象 + return false; + } - var ee = JSON.parse(JSON.stringify(e)); - var appd = getApp().globalData; - //-- 等待定位系统的开启 -- - th.waitfor2(15, 'is_get_local_ok', function () { - if (!th.data.is_get_local_ok) return false; + var ee = JSON.parse(JSON.stringify(e)); + var appd = getApp().globalData; + //-- 等待定位系统的开启 -- + th.waitfor2(15, 'is_get_local_ok', function () { - var e = JSON.parse(JSON.stringify(ee)); - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { - that.set_def_storage(e); - } else { - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { - store_id: os.stoid, - pickup_id: e.pickup_id, - is_pos: 1, - lat: th.data.lat, - lon: th.data.lon - }, - }).then(res => { - if (res.data.code == 0) { - e = res.data.data.pageData[0]; - if (e) { - e.is_no_dis = ee.is_no_dis; - appd.pk_store = e; - that.set_def_storage(e); - } + if (!th.data.is_get_local_ok) return false; - } - }) - } - appd.lat = that.data.lat; - appd.lon = that.data.lon; - } else { - if (e) { - e.distance = null; - that.set_def_storage(e); - } - } - }) - }); + var e = JSON.parse(JSON.stringify(ee)); + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.set_def_storage(e); + } else { + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { + store_id: os.stoid, + pickup_id: e.pickup_id, + is_pos: 1, + lat: th.data.lat, + lon: th.data.lon + }, + }).then(res => { + if (res.data.code == 0) { + e = res.data.data.pageData[0]; + if (e) { + e.is_no_dis = ee.is_no_dis; + appd.pk_store = e; + that.set_def_storage(e); + } - //----获取系统参数----- - getApp().getConfig2(function (e) { - ee.setData({ - bconfig: e, - sales_rules: e.sales_rules, - }); - //设置基本参数 - th.wait_for_store_config(e); - - var json_d = JSON.parse(e.switch_list); - ee.setData({ - store_config: e, - sys_switch: json_d, - is_closecoupon: json_d.is_closecoupon, - is_newsales_rules: json_d.is_newsales_rules, - is_open_offline: json_d.is_pricing_open, - sales_rules: e.sales_rules + } + }) + } + appd.lat = that.data.lat; + appd.lon = that.data.lon; + } else { + if (e) { + e.distance = null; + that.set_def_storage(e); + } + } + }) }); - //-- 计算等级价相关 -- - var swithc_list = e.switch_list; - var sw_arr = JSON.parse(swithc_list); - //---如果后台又开等级卡的开关--- - if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { - th.setData({ - rank_switch: true + //----获取系统参数----- + getApp().getConfig2(function (e) { + ee.setData({ + bconfig: e, + sales_rules: e.sales_rules, + }); + //设置基本参数 + th.wait_for_store_config(e); + + var json_d = JSON.parse(e.switch_list); + ee.setData({ + store_config: e, + sys_switch: json_d, + is_closecoupon: json_d.is_closecoupon, + is_newsales_rules: json_d.is_newsales_rules, + is_open_offline: json_d.is_pricing_open, + sales_rules: e.sales_rules }); - //---回调卡的列表--- - th.getPlusCardType(function (ob) { + + //-- 计算等级价相关 -- + var swithc_list = e.switch_list; + var sw_arr = JSON.parse(swithc_list); + //---如果后台又开等级卡的开关--- + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { th.setData({ - card_list: ob.card_list + rank_switch: true }); - var user = getApp().globalData.userInfo; - if (!user) return false; - if (user.card_field && user['card_expiredate']) { - var str = user['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; - var now = ut.gettimestamp(); - //--- 判断是等级会员,且在有效期范围内 --- - if (user.card_field && now < end) { - var card_name = ob.name_map.get(user.card_field); - th.setData({ - card_field: user.card_field, - card_name: card_name, - card_list: ob.card_list - }); + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + th.setData({ + card_list: ob.card_list + }); + var user = getApp().globalData.userInfo; + if (!user) return false; + if (user.card_field && user['card_expiredate']) { + var str = user['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + var now = ut.gettimestamp(); + //--- 判断是等级会员,且在有效期范围内 --- + if (user.card_field && now < end) { + var card_name = ob.name_map.get(user.card_field); + th.setData({ + card_field: user.card_field, + card_name: card_name, + card_list: ob.card_list + }); + } } - } + //获取购物车的内容 + th.get_cart_val(e); + + }) + } else { //获取购物车的内容 th.get_cart_val(e); + } + }, 1); - }) - } else { - //获取购物车的内容 - th.get_cart_val(e); - } - }, 1); - - }) + }) - } + } else { + getApp().goto("/pages/togoin/togoin"); + return false; + } + }) }, onHide: function () { @@ -1895,7 +1894,7 @@ Page({ getApp().request.put("/api/weshop/cart/update", { data: updata, - success: function (t) {} + success: function (t) { } }); th.re_sum_price(); }) @@ -1972,7 +1971,7 @@ Page({ if (this.data.act.is_bzyh && zhqty_bz.length > 0) { if (zhqty_bz.length > 1) { let zhqty_bz_arr = []; - let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); + let zhqty_bz_flag = this.zhqty_bz_fun(zhqty_bz, be, zhqty_bz_arr); if (zhqty_bz_flag) { for (let i = 0; i < zhqty_bz.length; i++) { @@ -1988,7 +1987,7 @@ Page({ } } } else { - zhqty_len=1; + zhqty_len = 1; let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { return o['num']; })); @@ -2012,9 +2011,9 @@ Page({ } bz_num_ok = be * vv.zhqty; } - - for(let i = 0; i < zhqty_bz.length; i++){ - let item1=zhqty_bz[i]; + + for (let i = 0; i < zhqty_bz.length; i++) { + let item1 = zhqty_bz[i]; for (let j = 0; j < be * item1['zhqty']; j++) { let index = no_in_arr.findIndex(i => { return item1.goods_id === i.goods_id @@ -2258,14 +2257,14 @@ Page({ }, - zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){ - let zhqty_bz_flag =true; - for(let i=0;i num) { - zhqty_bz_flag=false; + zhqty_bz_flag = false; zhqty_bz_arr.push(item); // zhqty_bz.splice(i,1) } diff --git a/packageB/pages/zuhegou/index/index.json b/packageB/pages/zuhegou/index/index.json index d341c05..b3673aa 100644 --- a/packageB/pages/zuhegou/index/index.json +++ b/packageB/pages/zuhegou/index/index.json @@ -1,6 +1,6 @@ { "usingComponents": { - "catch": "/packageB//components/catch/catch", + "catch": "/packageB/components/catch/catch", "nodata": "/components/nodata/nodata", "painter": "/packageB/components/painter/painter", "warn": "/components/long_warn/long_warn" diff --git a/packageB/pages/zuhegou/index/index.wxml b/packageB/pages/zuhegou/index/index.wxml index dee4c07..d2ea6c5 100644 --- a/packageB/pages/zuhegou/index/index.wxml +++ b/packageB/pages/zuhegou/index/index.wxml @@ -16,7 +16,7 @@ - 门店: + 门店: {{def_pick_store.pickup_name}} {{def_pick_store.pickup_name}} @@ -77,16 +77,16 @@ - 再买{{need_to_buy}}件,下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】 + 再买{{need_to_buy}}件,下单立享【{{act.zhprice}}元选择{{act.zhbuyqty}}件】 - 下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】 + 下单立享【{{act.zhprice}}元选择{{act.zhbuyqty}}件】 - 再买{{act.zhbuyqty-all_num>need_to_buy?act.zhbuyqty-all_num:need_to_buy}}件,下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】 + 再买{{act.zhbuyqty-all_num>need_to_buy?act.zhbuyqty-all_num:need_to_buy}}件,下单立享【{{act.zhprice}}元选择{{act.zhbuyqty}}件】 - 买{{act.zhbuyqty}}件,下单立享【{{act.zhprice}}元任选{{act.zhbuyqty}}件】 + 买{{act.zhbuyqty}}件,下单立享【{{act.zhprice}}元选择{{act.zhbuyqty}}件】 @@ -118,7 +118,7 @@ 活动内容 - {{act.remark}} + {{filters.show_default(act.remark, '无')}} diff --git a/packageB/pages/zuhegou/index/index.wxss b/packageB/pages/zuhegou/index/index.wxss index f9e3077..2577190 100644 --- a/packageB/pages/zuhegou/index/index.wxss +++ b/packageB/pages/zuhegou/index/index.wxss @@ -35,6 +35,10 @@ page { font-size: 24rpx; } +.icon-zhuanfa { + line-height: 1; +} + .list-container { padding-top: 30rpx; } diff --git a/packageB/pages/zuhegou/preindex/index.js b/packageB/pages/zuhegou/preindex/index.js index 3ec6801..ee9aacc 100644 --- a/packageB/pages/zuhegou/preindex/index.js +++ b/packageB/pages/zuhegou/preindex/index.js @@ -11,80 +11,80 @@ let imgDraw = { "height": "843px", "background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg", "views": [{ // 头像 - "type": "image", - "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", - "css": { - "width": "100px", - "height": "100px", - "top": "20px", - "left": "275px", - "borderRadius": "100px", - "mode": "scaleToFill", - "borderWidth": "2px", - "borderColor": "#fff", - } - }, - { //昵称 - "type": "text", - "text": "我是店铺名", - "css": { - "width": "650px", - "color": "#fff", - "top": "136px", - // "left": "137px", - "textAlign": "center", - "fontSize": "26px", - "maxLines": "1", - } - }, - { //10元任选3件 - "type": "text", - "text": "10元任选3件", - "css": { - "color": "#fff", - "width": "650px", - "top": "270px", - "fontSize": "70px", - "maxLines": "1", - "textAlign": "center", - "fontWeight": "bold", - } - }, - { //活动时间 - "type": "text", - "text": "活动时间:2021.07.06 - 2021.07.08", - "css": { - "color": "#333", - "width": "650px", - "top": "440px", - "fontSize": "26px", - "fontWeight": "normal", - "maxLines": "1", - "textAlign": "center" - } - }, - { // 码 - "type": "image", - "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", - "css": { - "color": "#000", - "width": "200px", - "height": "200px", - "top": "525px", - "left": "225px", - } - }, - { // 扫码提示 - "type": "text", - "text": "长按扫码即可参与活动", - "css": { - "color": "#666", - "width": "650px", - "top": "750px", - "fontSize": "26px", - "textAlign": "center" - } - }, + "type": "image", + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", + "css": { + "width": "100px", + "height": "100px", + "top": "20px", + "left": "275px", + "borderRadius": "100px", + "mode": "scaleToFill", + "borderWidth": "2px", + "borderColor": "#fff", + } + }, + { //昵称 + "type": "text", + "text": "我是店铺名", + "css": { + "width": "650px", + "color": "#fff", + "top": "136px", + // "left": "137px", + "textAlign": "center", + "fontSize": "26px", + "maxLines": "1", + } + }, + { //10元任选3件 + "type": "text", + "text": "10元任选3件", + "css": { + "color": "#fff", + "width": "650px", + "top": "270px", + "fontSize": "70px", + "maxLines": "1", + "textAlign": "center", + "fontWeight": "bold", + } + }, + { //活动时间 + "type": "text", + "text": "活动时间:2021.07.06 - 2021.07.08", + "css": { + "color": "#333", + "width": "650px", + "top": "440px", + "fontSize": "26px", + "fontWeight": "normal", + "maxLines": "1", + "textAlign": "center" + } + }, + { // 码 + "type": "image", + "url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg", + "css": { + "color": "#000", + "width": "200px", + "height": "200px", + "top": "525px", + "left": "225px", + } + }, + { // 扫码提示 + "type": "text", + "text": "长按扫码即可参与活动", + "css": { + "color": "#666", + "width": "650px", + "top": "750px", + "fontSize": "26px", + "textAlign": "center" + } + }, ] }; @@ -153,227 +153,226 @@ Page({ } }) } - - //如果有会员的时候 - var userInfo = getApp().globalData.userInfo; - if (!userInfo) { - getApp().goto("/pages/togoin/togoin"); - return false; - } }, /** * 生命周期函数--监听页面显示 */ onShow: function () { - var th = this, - that = this, - ee = this; - this.data.is_timer = 1; - if (this.data.act) this.countDown(); - //如果有会员的时候 - var userInfo = getApp().globalData.userInfo; - if (userInfo) { - if (!th.data.is_get_act) { - //获取活动信息 - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id; - getApp().request.get(url, { - success: function (e) { - - th.data.is_get_act = 1; - if (e.data.code == 0 && e.data.data) { - self.setData({ - act: e.data.data - }); - if (e.data.data.is_show != 1) { - th.setData({ - error: '活动未开启' + getApp().is_Single_page(this, function () { + var th = this, + that = this, + ee = this; + this.data.is_timer = 1; + if (this.data.act) this.countDown(); + //如果有会员的时候 + var userInfo = getApp().globalData.userInfo; + if (userInfo) { + if (!th.data.is_get_act) { + //获取活动信息 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id; + getApp().request.get(url, { + success: function (e) { + + th.data.is_get_act = 1; + if (e.data.code == 0 && e.data.data) { + self.setData({ + act: e.data.data }); - return false; - } - // if (ut.gettimestamp() < e.data.data.start_time) { - // th.setData({ - // error: '活动还未开始' - // }); - // return false; - // } - if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { - //-- 获取商品列表 -- - self.get_list(); - self.countDown(); + if (e.data.data.is_show != 1) { + th.setData({ + error: '活动未开启' + }); + return false; + } + // if (ut.gettimestamp() < e.data.data.start_time) { + // th.setData({ + // error: '活动还未开始' + // }); + // return false; + // } + if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { + //-- 获取商品列表 -- + self.get_list(); + self.countDown(); + } else { + th.setData({ + error: '活动已经过期' + }); + return false; + } } else { + th.data.is_get_act = 0; th.setData({ - error: '活动已经过期' + error: e.data.msg }); return false; } - } else { - th.data.is_get_act = 0; - th.setData({ - error: e.data.msg - }); - return false; } - } - }); - } - - //等待活动值 - this.waitfor2(10, 'list', function () { - if (!th.data.list) return false; - if (ut.gettimestamp() < th.data.act.start_time) { - return false; - } - if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) { - return false; + }); } - //获取头像的分享 - th.get_head_temp(function () { - var txt = th.data.act.zhprice + "元任选" + th.data.act.zhbuyqty + "件"; - imgDraw.views[0].url = th.data.share_head; - imgDraw.views[1].text = userInfo.nickname; - imgDraw.views[2].text = txt; - - var start = ut.formar_no_full(th.data.act.start_time, '.'); - var end = ut.formar_no_full(th.data.act.end_time, '.'); - txt = "活动时间:" + start + " - " + end; - imgDraw.views[3].text = txt; - - var scene = th.data.id + ""; - var user_id = getApp().globalData.user_id; - scene += "_" + user_id; - ///二微码 - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + - os.stoid + "?sceneValue=" + scene + "&pageValue=packageB/pages/zuhegou/index/index"; - wx.getImageInfo({ - src: path3, - success: function (res) { - var vpath = res.path; - imgDraw.views[4].url = vpath; - th.setData({ - imgDraw: imgDraw - }) - } - }) - }) - //获取用户的默认门店 - getApp().get_user_store(function (e) { - if (!e) { - th.data.fir_def_store = {}; //赋值空对象 + //等待活动值 + this.waitfor2(10, 'list', function () { + if (!th.data.list) return false; + if (ut.gettimestamp() < th.data.act.start_time) { return false; } + if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) { + return false; + } + //获取头像的分享 + th.get_head_temp(function () { + var txt = th.data.act.zhprice + "元任选" + th.data.act.zhbuyqty + "件"; + imgDraw.views[0].url = th.data.share_head; + imgDraw.views[1].text = userInfo.nickname; + imgDraw.views[2].text = txt; + + var start = ut.formar_no_full(th.data.act.start_time, '.'); + var end = ut.formar_no_full(th.data.act.end_time, '.'); + txt = "活动时间:" + start + " - " + end; + imgDraw.views[3].text = txt; + + var scene = th.data.id + ""; + var user_id = getApp().globalData.user_id; + scene += "_" + user_id; + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=packageB/pages/zuhegou/index/index"; + wx.getImageInfo({ + src: path3, + success: function (res) { + var vpath = res.path; + imgDraw.views[4].url = vpath; + th.setData({ + imgDraw: imgDraw + }) + } + }) + }) + //获取用户的默认门店 + getApp().get_user_store(function (e) { + if (!e) { + th.data.fir_def_store = {}; //赋值空对象 + return false; + } - var ee = JSON.parse(JSON.stringify(e)); - var appd = getApp().globalData; - //-- 等待定位系统的开启 -- - th.waitfor2(15, 'is_get_local_ok', function () { - if (!th.data.is_get_local_ok) return false; + var ee = JSON.parse(JSON.stringify(e)); + var appd = getApp().globalData; + //-- 等待定位系统的开启 -- + th.waitfor2(15, 'is_get_local_ok', function () { - var e = JSON.parse(JSON.stringify(ee)); - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { - that.set_def_storage(e); - } else { - //要用接口是获取距离,js的计算不准 - getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { - store_id: os.stoid, - pickup_id: e.pickup_id, - is_pos: 1, - lat: th.data.lat, - lon: th.data.lon - }, - }).then(res => { - if (res.data.code == 0) { - e = res.data.data.pageData[0]; - if (e) { - e.is_no_dis = ee.is_no_dis; - appd.pk_store = e; - that.set_def_storage(e); - } + if (!th.data.is_get_local_ok) return false; - } - }) - } - appd.lat = that.data.lat; - appd.lon = that.data.lon; - } else { - if (e) { - e.distance = null; - that.set_def_storage(e); - } - } - }) - }); + var e = JSON.parse(JSON.stringify(ee)); + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.set_def_storage(e); + } else { + //要用接口是获取距离,js的计算不准 + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { + store_id: os.stoid, + pickup_id: e.pickup_id, + is_pos: 1, + lat: th.data.lat, + lon: th.data.lon + }, + }).then(res => { + if (res.data.code == 0) { + e = res.data.data.pageData[0]; + if (e) { + e.is_no_dis = ee.is_no_dis; + appd.pk_store = e; + that.set_def_storage(e); + } - //----获取系统参数----- - getApp().getConfig2(function (e) { - ee.setData({ - bconfig: e, - sales_rules: e.sales_rules, - }); - //设置基本参数 - th.wait_for_store_config(e); - - var json_d = JSON.parse(e.switch_list); - ee.setData({ - store_config: e, - sys_switch: json_d, - is_closecoupon: json_d.is_closecoupon, - is_newsales_rules: json_d.is_newsales_rules, - is_open_offline: json_d.is_pricing_open, - sales_rules: e.sales_rules + } + }) + } + appd.lat = that.data.lat; + appd.lon = that.data.lon; + } else { + if (e) { + e.distance = null; + that.set_def_storage(e); + } + } + }) }); - //-- 计算等级价相关 -- - var swithc_list = e.switch_list; - var sw_arr = JSON.parse(swithc_list); - //---如果后台又开等级卡的开关--- - if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { - th.setData({ - rank_switch: true + //----获取系统参数----- + getApp().getConfig2(function (e) { + ee.setData({ + bconfig: e, + sales_rules: e.sales_rules, + }); + //设置基本参数 + th.wait_for_store_config(e); + + var json_d = JSON.parse(e.switch_list); + ee.setData({ + store_config: e, + sys_switch: json_d, + is_closecoupon: json_d.is_closecoupon, + is_newsales_rules: json_d.is_newsales_rules, + is_open_offline: json_d.is_pricing_open, + sales_rules: e.sales_rules }); - //---回调卡的列表--- - th.getPlusCardType(function (ob) { + + //-- 计算等级价相关 -- + var swithc_list = e.switch_list; + var sw_arr = JSON.parse(swithc_list); + //---如果后台又开等级卡的开关--- + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { th.setData({ - card_list: ob.card_list + rank_switch: true }); - var user = getApp().globalData.userInfo; - if (!user) return false; - if (user.card_field && user['card_expiredate']) { - var str = user['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; - var now = ut.gettimestamp(); - //--- 判断是等级会员,且在有效期范围内 --- - if (user.card_field && now < end) { - var card_name = ob.name_map.get(user.card_field); - th.setData({ - card_field: user.card_field, - card_name: card_name, - card_list: ob.card_list - }); + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + th.setData({ + card_list: ob.card_list + }); + var user = getApp().globalData.userInfo; + if (!user) return false; + if (user.card_field && user['card_expiredate']) { + var str = user['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + var now = ut.gettimestamp(); + //--- 判断是等级会员,且在有效期范围内 --- + if (user.card_field && now < end) { + var card_name = ob.name_map.get(user.card_field); + th.setData({ + card_field: user.card_field, + card_name: card_name, + card_list: ob.card_list + }); + } } - } + //获取购物车的内容 + th.get_cart_val(e); + + }) + } else { //获取购物车的内容 th.get_cart_val(e); + } + }, 1); - }) - } else { - //获取购物车的内容 - th.get_cart_val(e); - } - }, 1); + }) - }) + } else { + getApp().goto("/pages/togoin/togoin"); + return false; + } + }) - } }, onHide: function () { @@ -1896,7 +1895,7 @@ Page({ getApp().request.put("/api/weshop/cart/update", { data: updata, - success: function (t) {} + success: function (t) { } }); th.re_sum_price(); }) @@ -1915,7 +1914,7 @@ Page({ var need_to_buy = 0; var data = this.data.list; var all_zhqty = 0; //所有商品要求起购数之后 - var zhqty_bz=[]; //超量 + var zhqty_bz = []; //超量 var no_in_arr = []; for (var i in data) { var item = data[i]; @@ -1966,28 +1965,28 @@ Page({ //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) { - let zhqty_map=new map(); - //看一下是几倍 + let zhqty_map = new map(); + //看一下是几倍 var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); - if(this.data.act.is_bzyh && zhqty_bz.length > 0 ){ - for(let i=0;i 0) { + for (let i = 0; i < zhqty_bz.length; i++) { + let vv = zhqty_bz[i]; + let num = 0; + let bz_num = be * vv.zhqty; + for (let j = 0; j < no_in_arr.length; j++) { + let ii = no_in_arr[j]; + if (vv.goods_id === ii.goods_id) { num++; - zhqty_map.set('num',num); - zhqty_map.set('price',ii.price); + zhqty_map.set('num', num); + zhqty_map.set('price', ii.price); } - + } } } - if(bz_num <= num){ + if (bz_num <= num) { aprice += be * aprice; - let pop_num=(be * this.data.act.zhbuyqty)-bz_num; + let pop_num = (be * this.data.act.zhbuyqty) - bz_num; console.log(pop_num); for (var m = 0; m < pop_num; m++) { no_in_arr.pop(); diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml index df0180a..a35df7b 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml @@ -5,7 +5,7 @@ - + {{sele_g.goods_name}} diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 64ce889..7757199 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -8,7 +8,7 @@ var t = require("../../../../utils/util.js"), oo = s.globalData, o = s.globalData.setting, os = o; - + //评价加载更多 var more = function (e) { return e && e.__esModule ? e : { @@ -251,48 +251,48 @@ Page({ fir_goods: null, share_hidden: false, - - showRules: false, // 控制规则显示与隐藏 - showReward: false, //控制查看奖励显示与隐藏 - - typeArr: [{ - key: 'point', - name: '积分', - },{ - key: 'grow', - name: '成长值', - },{ - key: 'point', - name: '优惠券', - },{ - key: 'prestore_name', - name: '项目服务', - },{ - key: 'prestore_money', - name: '预存金额', - }], - - - luckGoInfo: {}, - showDetails: false, - num_success: 0, //成团已中商品数量 - isTimeUp: false, - - surplus: 0, - canBuy: false, - btnHidden: false, + + showRules: false, // 控制规则显示与隐藏 + showReward: false, //控制查看奖励显示与隐藏 + + typeArr: [{ + key: 'point', + name: '积分', + }, { + key: 'grow', + name: '成长值', + }, { + key: 'point', + name: '优惠券', + }, { + key: 'prestore_name', + name: '项目服务', + }, { + key: 'prestore_money', + name: '预存金额', + }], + + + luckGoInfo: {}, + showDetails: false, + num_success: 0, //成团已中商品数量 + isTimeUp: false, + + surplus: 0, + canBuy: false, + btnHidden: false, }, //------初始化加载---------- onLoad: function (t) { - + // console.log('onload'); - if(t && t.group_id) { - this.data.group_id = t.group_id; - }; - + if (t && t.group_id) { + this.data.group_id = t.group_id; + }; + + - var ee = this, that = ee, th = ee, @@ -303,45 +303,45 @@ Page({ prom_type = t.prom_type, prom_id = t.group_id; //活动ID - if(prom_type) { - // this.data.prom_type = prom_type; - // this.data.prom_id = prom_id; - this.setData({ - prom_type, - prom_id, - }); - } - - + if (prom_type) { + // this.data.prom_type = prom_type; + // this.data.prom_id = prom_id; + this.setData({ + prom_type, + prom_id, + }); + } + + //---获取手机地址坐标-- //--如果tg_id是空的话,分享回来-- - // console.log('扫描海报gid'); + // console.log('扫描海报gid'); if (gid == undefined || gid == null || gid == "") { var gid_str = decodeURIComponent(t.scene); gid_str = gid_str.split("_"); gid = gid_str[0]; - if(gid.indexOf('.')!=-1) { - var fir_arr=gid.split("."); - gid=fir_arr[0]; - prom_type=fir_arr[1]; - prom_id=fir_arr[2]; - // this.setData({ - // prom_type: prom_type, - // prom_id: prom_id, - // group_id: fir_arr[2], - // }); - this.data.prom_type=prom_type; - this.data.prom_id=prom_id; - this.data.group_id = fir_arr[2]; + if (gid.indexOf('.') != -1) { + var fir_arr = gid.split("."); + gid = fir_arr[0]; + prom_type = fir_arr[1]; + prom_id = fir_arr[2]; + // this.setData({ + // prom_type: prom_type, + // prom_id: prom_id, + // group_id: fir_arr[2], + // }); + this.data.prom_type = prom_type; + this.data.prom_id = prom_id; + this.data.group_id = fir_arr[2]; } if (gid_str.length > 1) { first_leader = gid_str[1]; } - + //-- 如果有room_id的获取 -- if (gid_str.length > 2 && gid_str[2]) { room_id = gid_str[2]; @@ -351,7 +351,7 @@ Page({ } ee.setData({ gid: gid }); - + if (first_leader) { getApp().globalData.first_leader = first_leader; @@ -418,10 +418,10 @@ Page({ th.requestCardNum(), wx.pageScrollTo && th.setData({ supportPageScroll: !0 }); - - - - + + + + //计算等级价相关 var swithc_list = e.switch_list; @@ -496,7 +496,7 @@ Page({ } else { //要用接口是获取距离,js的计算不准 getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon,is_pos:1 }, + data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon, is_pos: 1 }, }).then(res => { if (res.data.code == 0) { e = res.data.data.pageData[0]; @@ -532,12 +532,14 @@ Page({ //--先判断会员登陆状态-- var user_info = getApp().globalData.userInfo; if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + + getApp().is_Single_page(th, function () { wx.navigateTo({ - url: '/pages/togoin/togoin', + url: '/pages/togoin/togoin', }) return false; + }) } - }, @@ -633,7 +635,7 @@ Page({ } gallery = g; }) - + //------是否收藏---------- await getApp().request.promiseGet("/api/weshop/goodscollect/page", { data: { @@ -701,7 +703,7 @@ Page({ } } - if (th.data.is_closecoupon != 1 && (!th.data.fir_quan || th.data.fir_quan.length<=0)) { + if (th.data.is_closecoupon != 1 && (!th.data.fir_quan || th.data.fir_quan.length <= 0)) { //----获取详情页的券的数量---- await getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { data: { @@ -725,16 +727,16 @@ Page({ mapurl_f_img = res1.data.data.video_img; } }) - - - - - - - - - - + + + + + + + + + + ee.setData({ gallery: gallery, @@ -751,7 +753,7 @@ Page({ //---展示--- onShow: async function () { - // console.log('onshow'); + // console.log('onshow'); var goods_list = null, th = this, that = this; var show_prew_img = this.data.show_prew_img if (show_prew_img) { @@ -761,57 +763,57 @@ Page({ // 判断活动是否暂停 //获取单个活动成团信息 - await getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { - data: { - store_id: o.stoid, - is_end: 0, - timetype: 1, - id: this.data.group_id, - } - }).then(res => { - // console.log() - // console.log('判断活动是否暂停=======》', res.data.data); - if (res.data.code == 0) { - if(res.data.data.pageData && res.data.data.pageData.length == 0) { - let obj = { - day: '00', - hou: '00', - min: '00', - sec: '00' - }; - - th.setData({ - djs: obj, - isTimeUp: true, - }); - } else { - th.setData({ - luckGoInfo: res.data.data.pageData[0], - team_id: res.data.data.pageData[0].team_id, - luckGoMembers: [], - }); - - th.countDown(th.data.luckGoInfo.end_time, 0); - }; - - } else { + await getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { + data: { + store_id: o.stoid, + is_end: 0, + timetype: 1, + id: this.data.group_id, + } + }).then(res => { + // console.log() + // console.log('判断活动是否暂停=======》', res.data.data); + if (res.data.code == 0) { + if (res.data.data.pageData && res.data.data.pageData.length == 0) { + let obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' + }; + + th.setData({ + djs: obj, + isTimeUp: true, + }); + } else { + th.setData({ + luckGoInfo: res.data.data.pageData[0], + team_id: res.data.data.pageData[0].team_id, + luckGoMembers: [], + }); + + th.countDown(th.data.luckGoInfo.end_time, 0); + }; + + } else { // this.data.isTimeUp = true; - th.setData({ - isTimeUp: true, + th.setData({ + isTimeUp: true, }); - - }; - - + + }; + + }); - + // 活动暂停显示空白 if (this.data.isTimeUp) { wx.showModal({ title: '提示', content: '活动已经暂停', showCancel: false, - success: function(){ + success: function () { wx.navigateBack(); } }) @@ -880,18 +882,18 @@ Page({ }); } } - + //动态获取商品名称 wx.setNavigationBarTitle({ title: t.data.data.goods_name, }); - + //-- 把商品的赋值 -- ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); - if(ee.data.prom_type!=1 && ee.data.prom_type!=4 && ee.data.prom_type!=6) - ee.check_is_youhui(ee.data.gid); + if (ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6) + ee.check_is_youhui(ee.data.gid); t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); @@ -917,12 +919,12 @@ Page({ a.wxParse("content", "html", t.data.data.goods_content, ee, 6); e.wxParseAddFullImageUrl(ee, "content"); - if(ee.data.prom_type){ - //999 - t.data.data.prom_type=ee.data.prom_type; - t.data.data.prom_id=ee.data.prom_id; + if (ee.data.prom_type) { + //999 + t.data.data.prom_type = ee.data.prom_type; + t.data.data.prom_id = ee.data.prom_id; } - + ee.setData({ data: t.data.data, sele_g: t.data.data, @@ -935,7 +937,7 @@ Page({ //默认门店要拿下门店库存 // if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { // //获取门店 - // ee.get_sto(1); + // ee.get_sto(1); // } else { // //获取门店 @@ -1021,112 +1023,112 @@ Page({ this.data.enterAddressPage && (this.data.enterAddressPage = !1); - //获取单个活动已成团数量 - getApp().request.get(`/api/weshop/prom/luckyTeam/getCtNum/${o.stoid}/${this.data.group_id}`, { - success: function (res) { - if(res.data.code == 0) { - th.setData({ - group_num: res.data.data, - }); - } - } - }); - - - //获取单个活动中奖记录 - getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { - data: { - store_id: os.stoid, - team_status: 2, - goods_id: this.data.gid, - rndid: 1, - } - }).then(res => { - if (res.data.code == 0) { - th.setData({ - luckGoWinners: res.data.data.pageData, - }); - } - }); - - - //获取单个活动成团已中商品数量 - let url_num_success = `/api/weshop/prom/luckyOrder/countActNum/${os.stoid}/${this.data.group_id}`; - getApp().request.get(url_num_success, { - success: function (res) { - if (res.data.code == 0) { - console.log('成团已中商品数量汇总',res.data.data); - th.setData({ - num_success: res.data.data, - }); - } - } - }); - - - - - - // 获取购买次数,判断是否已经超出限购 - // {store_id}/{user_id}/{aid} - let get_aid = this.data.prom_id || this.data.luckGoInfo.id; - await getApp().request.get('/api/weshop/prom/luckyOrder/countActNum/' + os.stoid + '/' + oo.user_id + '/' + get_aid, { - success: function (res) { - if(res.data.code == 0) { - console.log(oo.user_id, '判断是否超出限购,获取购买次数', res, ); - // th.setData({ - // num_joined: res.data.data, - // }); - let num_joined = res.data.data; - let group_join_num = th.data.luckGoInfo.group_join_num; - let canBuy = num_joined >= group_join_num ? false : true; - th.setData({ - canBuy, - }); - // console.log('canBuy', th.data.canBuy); - }; - }, - }); - - - //获取参团成员 - await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { - data: { - store_id: o.stoid, - team_id: th.data.team_id, - } - }).then(res => { - if (res.data.code == 0) { - // console.log(th.data.team_id,'参团成员===============》', res.data.data.pageData); - th.setData({ - luckGoMembers: res.data.data.pageData, - }); - } - }); - - var p1 = new Promise((resolve, reject) => { + //获取单个活动已成团数量 + getApp().request.get(`/api/weshop/prom/luckyTeam/getCtNum/${o.stoid}/${this.data.group_id}`, { + success: function (res) { + if (res.data.code == 0) { + th.setData({ + group_num: res.data.data, + }); + } + } + }); + + + //获取单个活动中奖记录 + getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { + data: { + store_id: os.stoid, + team_status: 2, + goods_id: this.data.gid, + rndid: 1, + } + }).then(res => { + if (res.data.code == 0) { + th.setData({ + luckGoWinners: res.data.data.pageData, + }); + } + }); + + + //获取单个活动成团已中商品数量 + let url_num_success = `/api/weshop/prom/luckyOrder/countActNum/${os.stoid}/${this.data.group_id}`; + getApp().request.get(url_num_success, { + success: function (res) { + if (res.data.code == 0) { + console.log('成团已中商品数量汇总', res.data.data); + th.setData({ + num_success: res.data.data, + }); + } + } + }); + + + + + + // 获取购买次数,判断是否已经超出限购 + // {store_id}/{user_id}/{aid} + let get_aid = this.data.prom_id || this.data.luckGoInfo.id; + await getApp().request.get('/api/weshop/prom/luckyOrder/countActNum/' + os.stoid + '/' + oo.user_id + '/' + get_aid, { + success: function (res) { + if (res.data.code == 0) { + console.log(oo.user_id, '判断是否超出限购,获取购买次数', res,); + // th.setData({ + // num_joined: res.data.data, + // }); + let num_joined = res.data.data; + let group_join_num = th.data.luckGoInfo.group_join_num; + let canBuy = num_joined >= group_join_num ? false : true; + th.setData({ + canBuy, + }); + // console.log('canBuy', th.data.canBuy); + }; + }, + }); + + + //获取参团成员 + await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { + data: { + store_id: o.stoid, + team_id: th.data.team_id, + } + }).then(res => { + if (res.data.code == 0) { + // console.log(th.data.team_id,'参团成员===============》', res.data.data.pageData); + th.setData({ + luckGoMembers: res.data.data.pageData, + }); + } + }); + + var p1 = new Promise((resolve, reject) => { // 检查幸运购活动商品库存 getApp().request.get("/api/weshop/activitylist/getActLen/" + o.stoid + "/9/" + this.data.group_id, { - success: function(res) { + success: function (res) { //console.log('当前幸运购活动的剩余库存', res.data.data); - if(res.data.code == 0) { + if (res.data.code == 0) { th.setData({ // 剩余库存量 surplus: res.data.data, }); - }; + }; resolve(); } }); - + }); - + var p2 = new Promise((resolve, reject) => { // 检查是否已经参团购买 getApp().request.get("/api/weshop/prom/luckyOrder/getUserOrderInfo/" + o.stoid + "/" + oo.user_id + "/" + this.data.group_id, { - success: function(res) { + success: function (res) { console.log('当前幸运购活动是否已经参团', res.data.code); - if(res.data.code == 0) { + if (res.data.code == 0) { th.setData({ showDetails: true, buyInfo: res.data.data, @@ -1139,52 +1141,52 @@ Page({ resolve(); } }); - + }); - + Promise.all([p1, p2]).then(res => { th.setData({ btnHidden: true, }); }); - - - console.log('hidddddnnnnnnnn------>>>>', this.data.btnHidden, this.data.isTimeUp) - + + + console.log('hidddddnnnnnnnn------>>>>', this.data.btnHidden, this.data.isTimeUp) + }, - - - - // 页面卸载 + + + + // 页面卸载 onUnload: function () { for (var i = 1; i < 100; i++) { clearInterval(i); } }, - - // 页面隐藏 + + // 页面隐藏 onHide: function () { this.data.is_timer = 0; for (var i = 1; i < 100; i++) { clearInterval(i); } }, - - // 点击顶部选项卡 + + // 点击顶部选项卡 tabClick: function (t) { var e = t.currentTarget.id; this.setData({ activeCategoryId: e - }), - 1 == e ? this.tabGoodsContent() : 2 == e && this.tabComment(); + }), + 1 == e ? this.tabGoodsContent() : 2 == e && this.tabComment(); }, - - - // 点击评价选项卡下的各评价按钮 + + + // 点击评价选项卡下的各评价按钮 tabClick3: function (t) { var e = this; if (t.currentTarget.id != this.data.activeCategoryId3) { @@ -1197,7 +1199,7 @@ Page({ } }, - // 滚动到顶部 + // 滚动到顶部 doScrollTop: function () { wx.pageScrollTo({ scrollTop: 0 @@ -1280,9 +1282,9 @@ Page({ th.setData({ open_ind_store: ind }); - - - th.add_cart_func(t); + + + th.add_cart_func(t); }, @@ -1447,9 +1449,9 @@ Page({ goods_name: o.goods_name, goods_sn: o.goods_sn, sku: o.sku, - prom_id:th.data.luckGoInfo.id, + prom_id: th.data.luckGoInfo.id, // prom_type:th.data.sele_g.prom_type, - prom_type:9, + prom_type: 9, }; //---是不是从收藏夹出来的--- @@ -1617,7 +1619,7 @@ Page({ add_cart_next(e, t, a, o, newd, CanOutQty) { var th = this, i = getApp().request; //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ - if ((o.prom_type != 1 || o.prom_id<=0) && ((o.prom_type != 6 && o.prom_type != 4) || th.data.is_normal)) { + if ((o.prom_type != 1 || o.prom_id <= 0) && ((o.prom_type != 6 && o.prom_type != 4) || th.data.is_normal)) { var conf = th.data.bconfig; if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) { var s_list = JSON.parse(conf.switch_list); @@ -1780,7 +1782,7 @@ Page({ // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, { // action: "buy_now" // }), - var th = this; + var th = this; this.setData({ openSpecModal: 0, openSpecModal_inte: 0, @@ -1788,15 +1790,15 @@ Page({ openSpecModal_pt: 0, }) - // if (e.prom_type == 9) { - // s.set_b_now(e); - // // var url = ''; - // var url = "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id; - // getApp().goto(url); - // } else - - // if(e.prom_type == 9){ - if(true){ + // if (e.prom_type == 9) { + // s.set_b_now(e); + // // var url = ''; + // var url = "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id; + // getApp().goto(url); + // } else + + // if(e.prom_type == 9){ + if (true) { //要判断积分购的普通购买有没有参加优惠活动 if (e.is_normal == 1) { this.check_nor_promgood(e.goods_id, function (res) { @@ -1804,28 +1806,28 @@ Page({ e.prom_type = 3; e.prom_id = res.cat_id; } else { - e.prom_type = 0; - // e.prom_id = 0; - } + e.prom_type = 0; + // e.prom_id = 0; + } s.set_b_now(e); /*-- wx.redirectTo({ url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, });--*/ - - // console.log('11111111111111111111111111======》'); + + // console.log('11111111111111111111111111======》'); // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id); - getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); + getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id + "&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); }) } else { - //console.log('222222222222222222222222222222======》'); + //console.log('222222222222222222222222222222======》'); //s.set_b_now(e); /*-- wx.redirectTo({ url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, });--*/ - //getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&goods_id=" + e.goods_id) + //getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&goods_id=" + e.goods_id) // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert); } @@ -2051,36 +2053,36 @@ Page({ }) return false; } - - - - if(th.data.more_flash && open_store==1){ - th.setData({is_pop_more:1}); - }else{ - var ind = t.currentTarget.dataset.ind; - //回调。判断是不是优惠促销 - th.check_is_prom_goods(function () { - th.setData({ - openSpecModal: !0, - openSpecModal_ind: ind, - }); - //var is_open=th.data.config - th.get_off_price(); - }) - } - }, - open_next(){ - var th=this; + + + if (th.data.more_flash && open_store == 1) { + th.setData({ is_pop_more: 1 }); + } else { + var ind = t.currentTarget.dataset.ind; //回调。判断是不是优惠促销 th.check_is_prom_goods(function () { - th.setData({ - openSpecModal: !0, - openSpecModal_ind: 1, - is_pop_more:0 - }); - th.get_off_price(); + th.setData({ + openSpecModal: !0, + openSpecModal_ind: ind, + }); + //var is_open=th.data.config + th.get_off_price(); }) + } + }, + + open_next() { + var th = this; + //回调。判断是不是优惠促销 + th.check_is_prom_goods(function () { + th.setData({ + openSpecModal: !0, + openSpecModal_ind: 1, + is_pop_more: 0 + }); + th.get_off_price(); + }) }, //判断是不是优惠促销 @@ -2407,47 +2409,47 @@ Page({ // ob.title = text + " " + name; // } - // var title = th.data.sele_g.goods_name; - // var img = th.data.sele_g.original_img; - - // var url = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${th.data.sele_g.goods_id}&prom_type=9&group_id=${th.data.group_id}`; //当前页面url - // if (getApp().globalData.user_id) { - // url += "&first_leader=" + getApp().globalData.user_id; - // } - - // console.log(url) - - // var ob = { - // title: price + "元 " + title, - // path: url, - // imageUrl: img, - // }; - - // return ob; - - - var pagePath = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${this.data.sele_g.goods_id}&prom_type=9&group_id=${this.data.group_id}`; //当前页面url - // console.log('pagePath=====xxxxxx>', pagePath); - var imgPath = this.data.iurl + this.data.luckGoInfo.original_img; - if (pagePath.indexOf('/') != 0) { - pagePath = '/' + pagePath; - } - // if(getApp().globalData.user_id){ - - // if(pagePath.indexOf("?")>0){ - // pagePath+="&first_leader="+getApp().globalData.user_id; - // }else{ - // pagePath+="?first_leader="+getApp().globalData.user_id; - // } - // } - return { - title: "邀您一起参加幸运购", - path: pagePath, - imageUrl: imgPath, - } - - - + // var title = th.data.sele_g.goods_name; + // var img = th.data.sele_g.original_img; + + // var url = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${th.data.sele_g.goods_id}&prom_type=9&group_id=${th.data.group_id}`; //当前页面url + // if (getApp().globalData.user_id) { + // url += "&first_leader=" + getApp().globalData.user_id; + // } + + // console.log(url) + + // var ob = { + // title: price + "元 " + title, + // path: url, + // imageUrl: img, + // }; + + // return ob; + + + var pagePath = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${this.data.sele_g.goods_id}&prom_type=9&group_id=${this.data.group_id}`; //当前页面url + // console.log('pagePath=====xxxxxx>', pagePath); + var imgPath = this.data.iurl + this.data.luckGoInfo.original_img; + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + // if(getApp().globalData.user_id){ + + // if(pagePath.indexOf("?")>0){ + // pagePath+="&first_leader="+getApp().globalData.user_id; + // }else{ + // pagePath+="?first_leader="+getApp().globalData.user_id; + // } + // } + return { + title: "邀您一起参加幸运购", + path: pagePath, + imageUrl: imgPath, + } + + + }, //-----图片失败,默认图片----- @@ -2523,12 +2525,12 @@ Page({ if (res.data.code == 0) prom = res.data.data; }) break - - case 8: - continue; case 8: - continue; + continue; + + case 8: + continue; } @@ -2653,14 +2655,14 @@ Page({ async sele_spec_chech_activity() { //---如果是活动的时候--- var prom = null, goodsinfo = this.data.sele_g, th = this; - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=0; + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; if (goodsinfo.prom_type == 1) { - await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" +user_id+"/"+ goodsinfo.prom_id, { + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + goodsinfo.prom_id, { }).then(res => { if (res.data.code == 0) { - prom = res.data.data; - prom.price=prom.user_price; + prom = res.data.data; + prom.price = prom.user_price; } }) } @@ -2686,11 +2688,11 @@ Page({ var now = ut.gettimestamp(); if (prom) { - var t1=prom.start_time; - var prom_st=1; - if(prom.show_time){ - t1=prom.show_time; - if(prom.start_time>now) prom_st=0; + var t1 = prom.start_time; + var prom_st = 1; + if (prom.show_time) { + t1 = prom.show_time; + if (prom.start_time > now) prom_st = 0; } if (prom.is_end == 0 && prom.end_time > now && t1 < now) { th.setData({ @@ -2701,37 +2703,37 @@ Page({ prom_start_time: prom.start_time, prom_st: prom_st, prom_act: prom, - prom_id:prom.id + prom_id: prom.id }) - //却换图片 - th.init(goodsinfo.goods_id); - var newTime = ut.gettimestamp(); - var endTime2 = prom.end_time; - var endTime1 = prom.start_time; + //却换图片 + th.init(goodsinfo.goods_id); + var newTime = ut.gettimestamp(); + var endTime2 = prom.end_time; + var endTime1 = prom.start_time; - this.data.is_timer=0; + this.data.is_timer = 0; - setTimeout(function () { - th.data.is_timer=1; - if (endTime1 > newTime) { - th.setData({ - prom_time_text: '距秒杀开始还有' - }) - th.countDown(th.data.luckGoInfo.end_time, 0); - } else { - if (endTime2 > newTime) { - th.setData({ - prom_time_text: '距秒杀结束还有', - prom_st: 1 - }) - th.countDown(th.data.luckGoInfo.end_time); - } - } + setTimeout(function () { + th.data.is_timer = 1; + if (endTime1 > newTime) { + th.setData({ + prom_time_text: '距秒杀开始还有' + }) + th.countDown(th.data.luckGoInfo.end_time, 0); + } else { + if (endTime2 > newTime) { + th.setData({ + prom_time_text: '距秒杀结束还有', + prom_st: 1 + }) + th.countDown(th.data.luckGoInfo.end_time); + } + } - },1000) + }, 1000) - return false; + return false; } } //---设置普通商品--- @@ -3238,32 +3240,32 @@ Page({ //--------检查是否活动,活动是否开始,或者是否结束------- async check_prom(gid, prom_type, prom_id) { - var ee = this,th = ee; - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=0; + var ee = this, th = ee; + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; - if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7|| prom_type == 9) { + if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7 || prom_type == 9) { this.setData({ - prom_type: 0,isshow: 1, + prom_type: 0, isshow: 1, }); return false; } - if (prom_type == 1 && prom_id==0){ - this.setData({ - prom_type: 0,isshow: 1, - }); + if (prom_type == 1 && prom_id == 0) { + this.setData({ + prom_type: 0, isshow: 1, + }); - //获取门店 - this.get_sto(); - this.get_sku(o.stoid, this.data.data, gid); - this.check_has_flash(); - return false; + //获取门店 + this.get_sto(); + this.get_sku(o.stoid, this.data.data, gid); + this.check_has_flash(); + return false; } //if (prom_type != 3 && prom_type!=0){ //---判断秒杀---- - if (prom_type == 1 && prom_id>0) { + if (prom_type == 1 && prom_id > 0) { //-------判断活动是否抢光--------- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { 1: 1 @@ -3275,7 +3277,7 @@ Page({ prom_r_null: 1 }); //拿取价格并且判断时间-- - getApp().request.get("/api/ms/flash_sale/getNew/" +os.stoid + "/" +user_id+"/"+ prom_id, { + getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, { success: function (t) { if (t.data.code != 0) { ee.setData({ @@ -3353,51 +3355,51 @@ Page({ //如果是进行中的话 if (endTime1 < newTime) { - //-- 获取秒杀活动的多少规格 -- - ee.get_more_flahs(function (list) { - if (list && list.length > 1) { - - var n_item = list[0]; - var ind = list.findIndex(function (ele) { - return ele.goods_id == ee.data.data.goods_id; - }) - if (ind < 0) return false; - if (ind > 0) { - n_item = JSON.parse(JSON.stringify(list[ind])); - list.splice(ind, 1); - list.unshift(n_item); - } - - ee.data.sele_g.viplimited = n_item.viplimited; - ee.data.data.viplimited = n_item.viplimited; - - var gb = 1; - //-- 显示多规格 -- - for (let i in list) { - let item = list[i]; - var gg = ""; - if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; - if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; - - if (item.goods_spec != "" && item.goods_color != "") { - gg = item.goods_spec + "/" + item.goods_color; - } else if (item.goods_spec != "" || item.goods_color != "") { - gg = item.goods_spec + item.goods_color; - } else { - gg = "规格" + gb; - gb++; - } - item.gg = gg; - item.prom_id = item.prom_id; - item.prom_type = 1; - } + //-- 获取秒杀活动的多少规格 -- + ee.get_more_flahs(function (list) { + if (list && list.length > 1) { - ee.setData({ - sku_g: list, - }); + var n_item = list[0]; + var ind = list.findIndex(function (ele) { + return ele.goods_id == ee.data.data.goods_id; + }) + if (ind < 0) return false; + if (ind > 0) { + n_item = JSON.parse(JSON.stringify(list[ind])); + list.splice(ind, 1); + list.unshift(n_item); + } + ee.data.sele_g.viplimited = n_item.viplimited; + ee.data.data.viplimited = n_item.viplimited; + + var gb = 1; + //-- 显示多规格 -- + for (let i in list) { + let item = list[i]; + var gg = ""; + if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; + if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; + + if (item.goods_spec != "" && item.goods_color != "") { + gg = item.goods_spec + "/" + item.goods_color; + } else if (item.goods_spec != "" || item.goods_color != "") { + gg = item.goods_spec + item.goods_color; + } else { + gg = "规格" + gb; + gb++; } - }) + item.gg = gg; + item.prom_id = item.prom_id; + item.prom_type = 1; + } + + ee.setData({ + sku_g: list, + }); + + } + }) } } @@ -3733,35 +3735,35 @@ Page({ min: this.timeFormat(min), sec: this.timeFormat(sec) } - // console.log('cd'); + // console.log('cd'); } else { - - - - obj = { - day: '00', - hou: '00', - min: '00', - sec: '00' - } - - th.setData({ - djs: obj, - isTimeUp: true, - }); - // console.log('i am here'); - return false; + + + + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' + } + + th.setData({ + djs: obj, + isTimeUp: true, + }); + // console.log('i am here'); + return false; } - - // ---- - - - - - th.setData({ - djs: obj - }); - // ---- + + // ---- + + + + + th.setData({ + djs: obj + }); + // ---- setTimeout(function () { th.countDown(endTime) }, 1000); @@ -3796,12 +3798,12 @@ Page({ success: function (t) { if (t.data.code == 0) { var g_buy_num = t.data.data.goodsbuynum; - - //如果是秒杀的时候 - if(th.data.prom_type==0 && gd.prom_type == 1 ){ - gd.prom_type= 0; - } - + + //如果是秒杀的时候 + if (th.data.prom_type == 0 && gd.prom_type == 1) { + gd.prom_type = 0; + } + if (gd.prom_type == 1 || gd.prom_type == 2 || gd.prom_type == 4 || gd.prom_type == 6) { //----获取活动购买数---- getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { @@ -3858,7 +3860,7 @@ Page({ }, //--点击弹起拼单-- - // ind == 1 为普通购买 + // ind == 1 为普通购买 openSpecModel_pt: function (e) { this.setData({ open_ind_store: 9, goodsInputNum: 1 }); @@ -3876,125 +3878,125 @@ Page({ page: 1 } }).then(res => { - if(res.data.code == 0){ - if (res.data.data.total > 0) { - // 待支付订单页面 - wx.showModal({ - title: "您已经购买了该商品待支付中", - success: function (a) { - if (a.confirm) { - switOn = false; - wx.navigateTo({ - url: "/packageC/pages/luckyGo/luckyGo_order/luckyGo_order?order_id=" + res.data.data.pageData[0]['order_id'] - }); - } + if (res.data.code == 0) { + if (res.data.data.total > 0) { + // 待支付订单页面 + wx.showModal({ + title: "您已经购买了该商品待支付中", + success: function (a) { + if (a.confirm) { + switOn = false; + wx.navigateTo({ + url: "/packageC/pages/luckyGo/luckyGo_order/luckyGo_order?order_id=" + res.data.data.pageData[0]['order_id'] + }); } - }); - } else { - //--先判断会员状态-- - var user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { - wx.navigateTo({ - url: '/pages/togoin/togoin', - }) - return false; - }; + } + }); + } else { + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + return false; + }; - var th = this; - var ind = parseInt(e.currentTarget.dataset.ind); - - console.log('当前ind========>>>>', ind); - - //ind == 1是普通购买 - if (ind == 1) { - //如果拼单的sku data是空的,就要先获取一下 - if (th.data.sku_g_pt) { - th.get_sto(1); - th.setData({ - is_normal: ind, - openSpecModal_pt: 1 - }); - } else { - th.get_sto(1); - th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { - th.setData({ - is_normal: ind, - openSpecModal_pt: 1 - }); - }); - + var th = this; + var ind = parseInt(e.currentTarget.dataset.ind); + + console.log('当前ind========>>>>', ind); + + //ind == 1是普通购买 + if (ind == 1) { + //如果拼单的sku data是空的,就要先获取一下 + if (th.data.sku_g_pt) { + th.get_sto(1); + th.setData({ + is_normal: ind, + openSpecModal_pt: 1 + }); + } else { + th.get_sto(1); + th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { th.setData({ is_normal: ind, openSpecModal_pt: 1 }); - }; - th.check_is_youhui(th.data.gid, 1); - } else { + }); - // //拼单商品从这里进,先判断有没有买过商品, - // getApp().request.get("/api/weshop/order/page", { - // data: { - // // pt_prom_id: th.data.prom_act.id, - // user_id: oo.user_id, - // store_id: os.stoid, - // pageSize: 1, - // page: 1 - // }, - // success: function (e) { - // //--跳转到已经购买的情况-- - // if (e.data.data.pageData.length > 0) { - // var odr = e.data.data.pageData[0]; - // //还未支付 - // if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) { - // wx.showModal({ - // title: "您已经购买了该商品待支付中", - // success: function (a) { - // if (a.confirm) { - // wx.navigateTo({ - // url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id, - // }); - // } - // } - // }); - // } else if (odr.pt_status == 1 && odr.order_status == 1) { - - // if (this.data.is_go_to_team_show) return false; - // this.data.is_go_to_team_show = 1; - // wx.showLoading(); - - // /*--- - // wx.redirectTo({ - // url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn, - // });--*/ - // getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn); - - // } else { - // th.setData({ - // is_normal: ind, - // openSpecModal_pt: 1 - // }); - // } - - // } else { - // th.setData({ - // is_normal: ind, - // openSpecModal_pt: 1 - // }); - // } - // } - // }); - th.get_sto(1); th.setData({ - is_normal: 0, + is_normal: ind, openSpecModal_pt: 1 }); - - } + }; + th.check_is_youhui(th.data.gid, 1); + } else { + + // //拼单商品从这里进,先判断有没有买过商品, + // getApp().request.get("/api/weshop/order/page", { + // data: { + // // pt_prom_id: th.data.prom_act.id, + // user_id: oo.user_id, + // store_id: os.stoid, + // pageSize: 1, + // page: 1 + // }, + // success: function (e) { + // //--跳转到已经购买的情况-- + // if (e.data.data.pageData.length > 0) { + // var odr = e.data.data.pageData[0]; + // //还未支付 + // if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) { + // wx.showModal({ + // title: "您已经购买了该商品待支付中", + // success: function (a) { + // if (a.confirm) { + // wx.navigateTo({ + // url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id, + // }); + // } + // } + // }); + // } else if (odr.pt_status == 1 && odr.order_status == 1) { + + // if (this.data.is_go_to_team_show) return false; + // this.data.is_go_to_team_show = 1; + // wx.showLoading(); + + // /*--- + // wx.redirectTo({ + // url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn, + // });--*/ + // getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn); + + // } else { + // th.setData({ + // is_normal: ind, + // openSpecModal_pt: 1 + // }); + // } + + // } else { + // th.setData({ + // is_normal: ind, + // openSpecModal_pt: 1 + // }); + // } + // } + // }); + th.get_sto(1); + th.setData({ + is_normal: 0, + openSpecModal_pt: 1 + }); + } - } + + } }); - + @@ -4002,9 +4004,9 @@ Page({ //-----------------拼单生成方法--------------------- addCart_pt: function () { - this.setData({ - openSpecModal_pt: 0, - }); + this.setData({ + openSpecModal_pt: 0, + }); if (this.data.is_normal == 0) { //看一下有没有起购数,如果有起购数,要计算起购数 // var qnum = parseFloat(th.data.prom_act.minbuynum); @@ -4046,7 +4048,7 @@ Page({ // return false; // } // } - + //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购--- // if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { // if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { @@ -4095,7 +4097,7 @@ Page({ sto_sele_name: "" }); if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); - + //--------------此时操作的数据------------ var newd = { goods_id: o.goods_id, @@ -4168,11 +4170,11 @@ Page({ } } - - // else if (th.data.prom_type == 3) { - // newd.prom_type = 0; - // newd.prom_id = 0; - // } + + // else if (th.data.prom_type == 3) { + // newd.prom_type = 0; + // newd.prom_id = 0; + // } newd['pick_name'] = th.data.sto_sele_name; newd['pick_dis'] = th.data.sto_sele_distr; @@ -4186,25 +4188,25 @@ Page({ newd['prom_type'] = 0; newd['prom_id'] = e.act_id; } - console.log('aaaaa'); - newd['prom_type'] = 0; + console.log('aaaaa'); + newd['prom_type'] = 0; th.buyNow(newd); }); } else { - // 点击立即参团 - th.buyNow_pt(newd); - }; + // 点击立即参团 + th.buyNow_pt(newd); + }; }) }, //----------立即购买_pt----------- buyNow_pt: function (e) { s.set_b_now(e); wx.navigateTo({ - url: "/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id + "&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert + '&goods_price=' + this.data.luckGoInfo.group_price/100 + '&is_show=' + this.data.luckGoInfo.is_show, + url: "/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id + "&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert + '&goods_price=' + this.data.luckGoInfo.group_price / 100 + '&is_show=' + this.data.luckGoInfo.is_show, }); - - // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); + + // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); }, //-------跳转pt商品------- @@ -4526,95 +4528,95 @@ Page({ } }) }, - - - drawPoster(context, unit, img, vpath) { - // 1.灰色背景 - context.setFillStyle('#f2f1f6'); - context.rect(0,0,554*unit,899*unit); - context.fill(); - // 2.商城名称 - let shopName = this.data.sto_sele_name_1; - // let shopNameLen = context.measureText(shopName); - // let x_shopNameLen = (554 - shopNameLen.width)/2*unit; - // console.log('11111111111111',shopNameLen,x_shopNameLen); - context.setTextAlign('center'); - context.setFontSize(26*unit); - context.setFillStyle('black'); - context.fillText(shopName, 277*unit, 60*unit); - // // 3.推荐来源 - let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; - // let fromTextLen = context.measureText(fromText); - // let x_fromText = (375 - fromTextLen.width)/2; - // console.log('222222',fromTextLen,x_fromText); - context.setTextAlign('center'); - context.setFontSize(22*unit); - context.setFillStyle('#96959a'); - context.fillText(fromText, 277*unit, 105*unit); - // 4.海报背景 - // context.beginPath(); - // context.setStrokeStyle('#f2f1f6'); - context.setFillStyle('white'); - context.fillRect(37*unit, 157*unit, 480*unit, 673*unit); - // context.stroke(); - // context.fill(); - // 5.商品图片 - // 图片的x坐标 - let bg_x = 37*unit - // 图片的y坐标 - let bg_y = 157*unit - // 图片宽度 - let bg_w = 480*unit - // 图片高度 - let bg_h = 474*unit - // 图片圆角 - let bg_r = 4 - // 绘制海报背景图片圆角 - context.save() - context.beginPath() - context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI*1.5) - context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) - context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) - context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) - context.clip() - context.drawImage(img, bg_x, bg_y, bg_w, bg_h); - context.restore() - // 6.强烈推荐 - // context.beginPath(); - let tj_path = "../../../../images/share/q_tj.png"; - context.beginPath() - context.drawImage(tj_path, 54*unit, 648*unit, 85*unit, 30*unit); - context.setFontSize(16*unit) - context.setLineJoin('round'); //交点设置成圆角 - context.setFillStyle("white") - context.setTextAlign('left'); - context.fillText('强烈推荐', 64*unit, 672*unit); - // 7.商品价格 - let price = '¥' + this.data.data.shop_price; - // if (th.data.prom_act) - // pri0 = th.data.prom_act.price; - context.setFontSize(32*unit); - context.setFillStyle('#DE1117'); - context.fillText(price, 54*unit, 730*unit); - // 8.商品标题 - context.setFontSize(20*unit); - context.setFillStyle('#898989'); - this.draw_Text(context, this.data.data.goods_name, - 54*unit, 770*unit, 240*unit, 240*unit, unit); - // 9.小程序码 - context.drawImage(vpath, 375*unit, 660*unit, 120*unit, 120*unit); - context.setFontSize(16*unit); - context.setFillStyle('#777'); - context.fillText('长按识别二维码', 378*unit, 810*unit); - // 10.竖线 - context.beginPath(); - context.setFillStyle('#eee'); - context.rect(354*unit, 670*unit, 1*unit, 130*unit); - context.fill(); - - }, - - + + + drawPoster(context, unit, img, vpath) { + // 1.灰色背景 + context.setFillStyle('#f2f1f6'); + context.rect(0, 0, 554 * unit, 899 * unit); + context.fill(); + // 2.商城名称 + let shopName = this.data.sto_sele_name_1; + // let shopNameLen = context.measureText(shopName); + // let x_shopNameLen = (554 - shopNameLen.width)/2*unit; + // console.log('11111111111111',shopNameLen,x_shopNameLen); + context.setTextAlign('center'); + context.setFontSize(26 * unit); + context.setFillStyle('black'); + context.fillText(shopName, 277 * unit, 60 * unit); + // // 3.推荐来源 + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; + // let fromTextLen = context.measureText(fromText); + // let x_fromText = (375 - fromTextLen.width)/2; + // console.log('222222',fromTextLen,x_fromText); + context.setTextAlign('center'); + context.setFontSize(22 * unit); + context.setFillStyle('#96959a'); + context.fillText(fromText, 277 * unit, 105 * unit); + // 4.海报背景 + // context.beginPath(); + // context.setStrokeStyle('#f2f1f6'); + context.setFillStyle('white'); + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); + // context.stroke(); + // context.fill(); + // 5.商品图片 + // 图片的x坐标 + let bg_x = 37 * unit + // 图片的y坐标 + let bg_y = 157 * unit + // 图片宽度 + let bg_w = 480 * unit + // 图片高度 + let bg_h = 474 * unit + // 图片圆角 + let bg_r = 4 + // 绘制海报背景图片圆角 + context.save() + context.beginPath() + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) + context.clip() + context.drawImage(img, bg_x, bg_y, bg_w, bg_h); + context.restore() + // 6.强烈推荐 + // context.beginPath(); + let tj_path = "../../../../images/share/q_tj.png"; + context.beginPath() + context.drawImage(tj_path, 54 * unit, 648 * unit, 85 * unit, 30 * unit); + context.setFontSize(16 * unit) + context.setLineJoin('round'); //交点设置成圆角 + context.setFillStyle("white") + context.setTextAlign('left'); + context.fillText('强烈推荐', 64 * unit, 672 * unit); + // 7.商品价格 + let price = '¥' + this.data.data.shop_price; + // if (th.data.prom_act) + // pri0 = th.data.prom_act.price; + context.setFontSize(32 * unit); + context.setFillStyle('#DE1117'); + context.fillText(price, 54 * unit, 730 * unit); + // 8.商品标题 + context.setFontSize(20 * unit); + context.setFillStyle('#898989'); + this.draw_Text(context, this.data.data.goods_name, + 54 * unit, 770 * unit, 240 * unit, 240 * unit, unit); + // 9.小程序码 + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); + context.setFontSize(16 * unit); + context.setFillStyle('#777'); + context.fillText('长按识别二维码', 378 * unit, 810 * unit); + // 10.竖线 + context.beginPath(); + context.setFillStyle('#eee'); + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); + context.fill(); + + }, + + //--定义的保存图片方法,分享团--- saveImageToPhotosAlbum: function () { @@ -4627,16 +4629,16 @@ Page({ } if (this.data.share_hidden) { - this.setData({ share_hidden: false,}); + this.setData({ share_hidden: false, }); }; //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购 var type = 9; - console.log('type',type); + console.log('type', type); if (type == 6) type = 2; if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; - wx.showLoading({ title: '生成中...',}) + wx.showLoading({ title: '生成中...', }) var that = this, th = that; //设置画板显示,才能开始绘图 that.setData({ @@ -4647,8 +4649,8 @@ Page({ var unit = that.data.screenWidth / 750 * 1.35; //基础单位, var path2 = that.data.data.original_img; var scene = th.data.gid + ""; - scene+="."+th.data.sele_g.prom_type+"."+th.data.luckGoInfo.id; - // th.data.sele_g.prom_id + scene += "." + th.data.sele_g.prom_type + "." + th.data.luckGoInfo.id; + // th.data.sele_g.prom_id var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; if (user_id > 0) { @@ -4661,13 +4663,13 @@ Page({ scene += "_" + getApp().globalData.room_id; } ///二微码 - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + - os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + // os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; - console.log('path3......',path3); - + console.log('path3......', path3); + // 读取文件成功则OK-- wx.getImageInfo({ @@ -4682,86 +4684,86 @@ Page({ // context.fillStyle="#FFFFFF"; // context.fillRect(0,0,554 * unit, 899 * unit); - - // if(type == 0) { - // this.drawPoster(context); - // return false; - // }; - + + // if(type == 0) { + // this.drawPoster(context); + // return false; + // }; + //-- 如果有自定义海报的时候,判断背景的图片 -- if (th.data.share_b_img) { pg_path = th.data.share_b_img; } // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); - - - if(type == 0) { // 如果是普通商品,绘制新海报 - th.drawPoster(context, unit, th.data.share_goods_img, vpath); - } else { - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); - }; - - // th.drawPoster(context, unit, th.data.share_goods_img, vpath); - + + + if (type == 0) { // 如果是普通商品,绘制新海报 + th.drawPoster(context, unit, th.data.share_goods_img, vpath); + } else { + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + }; + + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); + //-- 是自定义海报的情况下 -- - if(type != 0) { - - - - if (th.data.poster && parseInt(th.data.poster.style) == 2) { - //在线上分享人的情况下 - if (parseInt(th.data.poster.show_headpic)) { - //获取坐标 - var x = parseFloat(th.data.poster.head_x) * 2; - var y = parseFloat(th.data.poster.head_y) * 2; - var x1 = (x + 90) * unit; - var y1 = (y + 50) * unit; - //--昵称--- - context.setFontSize(24 * unit) - context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, x1, y1); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; - //强烈推荐 改许程 - var tj_path = "../../../../images/share/q_tj.png"; - context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); - context.setFontSize(16 * unit); - context.setLineJoin('round'); //交点设置成圆角 - context.setFillStyle("white"); - context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); - - //context.setFillStyle("black") - //context.setFontSize(24 * unit) - //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); - } - } else { - //--昵称--- - context.setFontSize(24 * unit); - context.setFillStyle("black"); - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; - //强烈推荐 改许程 - // var tj_path = "../../../../images/share/q_tj.png"; - // let txt_gn = th.data.luckGoInfo.group_num + '人团'; - // let width_gn = ut.measureText(txt_gn, 15); - // context.drawImage(tj_path, 152 * unit + width, 54 * unit, (width_gn + 20) * unit, 30 * unit); - // context.setFontSize(16 * unit); - // context.setLineJoin('round'); //交点设置成圆角 - // context.setFillStyle("white"); - // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); - // 发出幸运购活动邀请 - context.setFillStyle("#7f7f7f") - context.setFontSize(21.3 * unit) - context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); - - } - - }; - - - - var share_title = th.data.data.goods_name; + if (type != 0) { + + + + if (th.data.poster && parseInt(th.data.poster.style) == 2) { + //在线上分享人的情况下 + if (parseInt(th.data.poster.show_headpic)) { + //获取坐标 + var x = parseFloat(th.data.poster.head_x) * 2; + var y = parseFloat(th.data.poster.head_y) * 2; + var x1 = (x + 90) * unit; + var y1 = (y + 50) * unit; + //--昵称--- + context.setFontSize(24 * unit) + context.setFillStyle("black") + context.fillText(app.globalData.userInfo.nickname, x1, y1); + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; + //强烈推荐 改许程 + var tj_path = "../../../../images/share/q_tj.png"; + context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); + context.setFontSize(16 * unit); + context.setLineJoin('round'); //交点设置成圆角 + context.setFillStyle("white"); + context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); + + //context.setFillStyle("black") + //context.setFontSize(24 * unit) + //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); + } + } else { + //--昵称--- + context.setFontSize(24 * unit); + context.setFillStyle("black"); + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit); + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; + //强烈推荐 改许程 + // var tj_path = "../../../../images/share/q_tj.png"; + // let txt_gn = th.data.luckGoInfo.group_num + '人团'; + // let width_gn = ut.measureText(txt_gn, 15); + // context.drawImage(tj_path, 152 * unit + width, 54 * unit, (width_gn + 20) * unit, 30 * unit); + // context.setFontSize(16 * unit); + // context.setLineJoin('round'); //交点设置成圆角 + // context.setFillStyle("white"); + // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); + // 发出幸运购活动邀请 + context.setFillStyle("#7f7f7f") + context.setFontSize(21.3 * unit) + context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); + + } + + }; + + + + var share_title = th.data.data.goods_name; if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) { share_title = th.data.prom_act.share_title; if (!share_title) share_title = th.data.prom_act.title; @@ -4781,8 +4783,8 @@ Page({ context.setFillStyle("red") - var pri0 = th.data.luckGoInfo.group_price/100; - // console.log('pri0========>>>>>', pri0); + var pri0 = th.data.luckGoInfo.group_price / 100; + // console.log('pri0========>>>>>', pri0); // if (th.data.prom_act) // pri0 = th.data.prom_act.price; pri0 = parseFloat(pri0).toFixed(2); @@ -4790,13 +4792,13 @@ Page({ context.fillText("¥", wd1 - 15, 185 * unit); context.setFontSize(31 * unit) context.fillText(pri0, wd1, 185 * unit); - - var tj_path = "../../../../images/share/q_tj.png"; - context.drawImage(tj_path, 315 * unit, 158 * unit, 85 * unit, 30 * unit); - context.setLineJoin('round'); //交点设置成圆角 - context.setFontSize(18 * unit); - context.setFillStyle("white"); - context.fillText('参团价', 330 * unit, 179 * unit); + + var tj_path = "../../../../images/share/q_tj.png"; + context.drawImage(tj_path, 315 * unit, 158 * unit, 85 * unit, 30 * unit); + context.setLineJoin('round'); //交点设置成圆角 + context.setFontSize(18 * unit); + context.setFillStyle("white"); + context.fillText('参团价', 330 * unit, 179 * unit); //---市场价划掉--- context.setFillStyle("gray") @@ -4811,7 +4813,7 @@ Page({ context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); context.stroke(); - } else if(type == 4 && type != 0) { + } else if (type == 4 && type != 0) { context.setFillStyle("black"); context.setFontSize(21.3 * unit) th.draw_Text(context, share_title, @@ -4831,12 +4833,12 @@ Page({ } //---中间大图--- - if(type != 0) { - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); - }; - - - + if (type != 0) { + context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); + }; + + + //-------大图后面就不一样了----------- switch (type) { case 0: break;//普通商品的展示 @@ -5049,130 +5051,130 @@ Page({ context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); } break; - - - case 9: - - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 680 * unit) - context.lineTo(520 * unit, 680 * unit) - context.stroke(); - - //---文字--- - context.setFillStyle("black") - context.setFontSize(24 * unit) - context.font = 'normal bold 18px'; - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); - - //还差N人,即可成团 - let group_num = th.data.luckGoInfo.group_num; - let num_joined = th.data.luckGoInfo.num; - let delta1 = group_num - num_joined; - let width_delta1 = ut.measureText(delta1, 15); - context.setFillStyle("black"); - context.setFontSize(21.3 * unit); - context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit); - context.setFillStyle("#FF6768"); - context.setFontSize(21.3 * unit); - context.fillText(delta1, 160 * unit, 772 * unit); - context.setFillStyle("black"); - context.setFontSize(21.3 * unit); - context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit); - - // N人得商品,N人全额退款 - let group_win = th.data.luckGoInfo.group_win; - let delta2 = group_num - group_win; - let width_delta2 = ut.measureText(delta2, 16); - let width_groupNum = ut.measureText(group_num, 15); - let width_groupWin = ut.measureText(group_win, 15); - context.setFillStyle("#FF6768"); - context.setFontSize(21.3 * unit); - context.fillText(group_win, 40 * unit, 806 * unit); - context.setFillStyle("black"); - context.setFontSize(21.3 * unit); - context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); - context.setFillStyle("#FF6768"); - context.setFontSize(21.3 * unit); - context.fillText(delta2, 160 * unit, 806 * unit); - context.setFillStyle("black"); - context.setFontSize(21.3 * unit); - context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); - - // 并得帮团惊喜礼品 - context.setFillStyle("black") - context.setFontSize(21.3 * unit) - context.fillText("并得帮团", 40 * unit, 840 * unit); - context.setFillStyle("#FF6768") - context.setFontSize(21.3 * unit) - context.fillText("惊喜礼品", 130 * unit, 840 * unit); - context.setFillStyle("black") - context.setFontSize(21.3 * unit) - context.fillText("!", 220 * unit, 840 * unit); - - - //---二维吗图--- - //-- 自定义海报 -- - if (th.data.poster) { - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); - } else { - //---二维吗图--- - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); - } - - break; + + + case 9: + + //---画线--- + context.setLineWidth(1 * unit) + context.moveTo(32 * unit, 680 * unit) + context.lineTo(520 * unit, 680 * unit) + context.stroke(); + + //---文字--- + context.setFillStyle("black") + context.setFontSize(24 * unit) + context.font = 'normal bold 18px'; + context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); + + //还差N人,即可成团 + let group_num = th.data.luckGoInfo.group_num; + let num_joined = th.data.luckGoInfo.num; + let delta1 = group_num - num_joined; + let width_delta1 = ut.measureText(delta1, 15); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(delta1, 160 * unit, 772 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit); + + // N人得商品,N人全额退款 + let group_win = th.data.luckGoInfo.group_win; + let delta2 = group_num - group_win; + let width_delta2 = ut.measureText(delta2, 16); + let width_groupNum = ut.measureText(group_num, 15); + let width_groupWin = ut.measureText(group_win, 15); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(group_win, 40 * unit, 806 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(delta2, 160 * unit, 806 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); + + // 并得帮团惊喜礼品 + context.setFillStyle("black") + context.setFontSize(21.3 * unit) + context.fillText("并得帮团", 40 * unit, 840 * unit); + context.setFillStyle("#FF6768") + context.setFontSize(21.3 * unit) + context.fillText("惊喜礼品", 130 * unit, 840 * unit); + context.setFillStyle("black") + context.setFontSize(21.3 * unit) + context.fillText("!", 220 * unit, 840 * unit); + + + //---二维吗图--- + //-- 自定义海报 -- + if (th.data.poster) { + var erm_x = parseFloat(th.data.poster.ewm_x) * 2; + var erm_y = parseFloat(th.data.poster.ewm_y) * 2; + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); + } else { + //---二维吗图--- + context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); + } + + break; } //--- 如果是自定义海报的时候 --- - if(type != 0) { - - if (th.data.poster && parseInt(th.data.poster.style) == 2) { - - //如果显示会员信息的话 - if (parseInt(th.data.poster.show_headpic)) { - //获取坐标 - var x = parseFloat(th.data.poster.head_x) * 2; - var y = parseFloat(th.data.poster.head_y) * 2; - //---绘制圆形要放在最后---- - context.save(); - context.beginPath(); - var h_x = x * unit; - var h_y = y * unit; - var h_r = 40 * unit; - var cx = h_x + h_r; - var cy = h_y + h_r; - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); - context.closePath(); - context.fill(); - context.clip(); - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); - context.restore(); - } - - } else { - //---绘制圆形要放在最后---- - context.save(); - context.beginPath(); - var h_x = 60 * unit; - var h_y = 24 * unit; - var h_r = 40 * unit; - var cx = h_x + h_r; - var cy = h_y + h_r; - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); - context.closePath(); - context.fill(); - context.clip(); - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); - context.restore(); - } - - }; - + if (type != 0) { + + if (th.data.poster && parseInt(th.data.poster.style) == 2) { + + //如果显示会员信息的话 + if (parseInt(th.data.poster.show_headpic)) { + //获取坐标 + var x = parseFloat(th.data.poster.head_x) * 2; + var y = parseFloat(th.data.poster.head_y) * 2; + //---绘制圆形要放在最后---- + context.save(); + context.beginPath(); + var h_x = x * unit; + var h_y = y * unit; + var h_r = 40 * unit; + var cx = h_x + h_r; + var cy = h_y + h_r; + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); + context.closePath(); + context.fill(); + context.clip(); + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); + context.restore(); + } + + } else { + //---绘制圆形要放在最后---- + context.save(); + context.beginPath(); + var h_x = 60 * unit; + var h_y = 24 * unit; + var h_r = 40 * unit; + var cx = h_x + h_r; + var cy = h_y + h_r; + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); + context.closePath(); + context.fill(); + context.clip(); + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); + context.restore(); + } + + }; + //把画板内容绘制成图片,并回调 画板图片路径 @@ -5410,7 +5412,7 @@ Page({ // } // }) }, - + // 选择门店 choice_store: function (ee) { var th = this; @@ -5426,7 +5428,7 @@ Page({ getApp().confirmBox("门店库存不足", null, 25000, !1); return false; } - + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) { getApp().confirmBox("门店库存不足", null, 25000, !1); return false; @@ -5486,7 +5488,7 @@ Page({ }) } }, - + //关闭选择门店 close_popup: function (e) { var th = this; @@ -5538,7 +5540,7 @@ Page({ sort_store: function () { }, - + // 返回按钮 returns: function () { this.setData({ @@ -5546,7 +5548,7 @@ Page({ choice_sort_store: 0 }); }, - + //---选择分类门店--- choice_sort_store: function (e) { var index = e.currentTarget.dataset.index; @@ -5680,7 +5682,7 @@ Page({ } else { th.setData({ - // openSpecModal_pt: 1, + // openSpecModal_pt: 1, store: 0, choice_sort_store: 0, sort_store: 0 @@ -5690,7 +5692,7 @@ Page({ th.get_off_price(); }) }, - + //---点击二级之后的选择--- choose_for_store: function (e) { var index_c = e.currentTarget.dataset.ind; @@ -5701,7 +5703,7 @@ Page({ }) }, - + //把选择的门店设置成默认的门店def_pick set_def_pick: function (e) { var th = this; @@ -5901,11 +5903,11 @@ Page({ go_plus: function () { getApp().goto("/pages/user/plus/plus"); }, - + go_card_info: function () { getApp().goto("/pages/user/cardinfo/cardinfo"); }, - + //-- 根据ID拿出门店 -- get_pick_from_list(pid) { var all_pick_list = this.data.all_pick_list; @@ -6134,7 +6136,7 @@ Page({ this.get_sto(0) this.setData({ openSpecModal_inte: 1, goodsInputNum: 1 }); }, - + //-- 积分购普通购买 -- go_pay_integral_normal: function () { var th = this; @@ -6259,227 +6261,236 @@ Page({ // }) // }, - //获取更多秒杀 - // get_more_flahs: async function (func) { - // var f_more=false; - // var user_id=getApp().globalData.user_id; - // if(!user_id) user_id=0; - - // var url="/api/weshop/goods/listSkuFlash?store_id="+os.stoid+"&goods_id="+this.data.data.goods_id+"&user_id="+user_id; - // //获取秒杀的多规格 - // await getApp().request.promiseGet(url, {}).then(res=>{ - // if(res.data.code==0 && res.data.data && res.data.data.length>0){ - // f_more=res.data.data; - // } - // }) - // if(!f_more) { - // func(false); - // return false; - // } - // //-- 秒杀的价格要更新 -- - // for(let i in f_more){ - - // let item=f_more[i]; - // f_more[i].prom_id=item.act_id; - // f_more[i].prom_type=1; - // if(item.goods_id==this.data.data.goods_id){ - // continue; - // } - // var url="/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+item.act_id; - // await getApp().request.promiseGet(url, {}).then(rs=>{ - // if(rs.data.code==0){ - // f_more[i].price=rs.data.data.user_price; + //获取更多秒杀 + // get_more_flahs: async function (func) { + // var f_more=false; + // var user_id=getApp().globalData.user_id; + // if(!user_id) user_id=0; + + // var url="/api/weshop/goods/listSkuFlash?store_id="+os.stoid+"&goods_id="+this.data.data.goods_id+"&user_id="+user_id; + // //获取秒杀的多规格 + // await getApp().request.promiseGet(url, {}).then(res=>{ + // if(res.data.code==0 && res.data.data && res.data.data.length>0){ + // f_more=res.data.data; + // } + // }) + // if(!f_more) { + // func(false); + // return false; + // } + // //-- 秒杀的价格要更新 -- + // for(let i in f_more){ + + // let item=f_more[i]; + // f_more[i].prom_id=item.act_id; + // f_more[i].prom_type=1; + // if(item.goods_id==this.data.data.goods_id){ + // continue; + // } + // var url="/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+item.act_id; + // await getApp().request.promiseGet(url, {}).then(rs=>{ + // if(rs.data.code==0){ + // f_more[i].price=rs.data.data.user_price; + + // } + // }) + // } + // func(f_more); - // } - // }) + // }, + + //-- 判断是否有秒杀 -- ccc + check_has_flash: function () { + // var th=this; + // var url="/api/weshop/activitylist/getGoodActInfo"; + // var req_data={ + // store_id:os.stoid,goodsidlist:this.data.data.goods_id,is_detail:1 + // }; + // //获取秒杀的多规格 + // getApp().request.promiseGet(url, {data:req_data}).then(res=>{ + // if(res.data.code==0 && res.data.data && res.data.data.length){ + // th.setData({more_flash:res.data.data}); // } - // func(f_more); - - // }, - - //-- 判断是否有秒杀 -- ccc - check_has_flash:function () { - // var th=this; - // var url="/api/weshop/activitylist/getGoodActInfo"; - // var req_data={ - // store_id:os.stoid,goodsidlist:this.data.data.goods_id,is_detail:1 - // }; - // //获取秒杀的多规格 - // getApp().request.promiseGet(url, {data:req_data}).then(res=>{ - // if(res.data.code==0 && res.data.data && res.data.data.length){ - // th.setData({more_flash:res.data.data}); - // } - // }) - }, + // }) + }, - //-- 跳转到秒杀商品详情页 -- ccc - go_more_flash:function (e) { - // var prom_id=e.currentTarget.dataset.id; - // var goods_id=this.data.data.goods_id; - // var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+goods_id+"&prom_id="+prom_id+"&prom_type=1"; - // getApp().goto(url); - }, + //-- 跳转到秒杀商品详情页 -- ccc + go_more_flash: function (e) { + // var prom_id=e.currentTarget.dataset.id; + // var goods_id=this.data.data.goods_id; + // var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+goods_id+"&prom_id="+prom_id+"&prom_type=1"; + // getApp().goto(url); + }, - close_pop_more:function () { - this.setData({is_pop_more:0}) - }, + close_pop_more: function () { + this.setData({ is_pop_more: 0 }) + }, + + con_weixin: function () { + var url = this.data.sys_switch.weapp_customertype_url; + var id = this.data.sys_switch.weapp_customertype_appid; + wx.openCustomerServiceChat({ + extInfo: { url: url }, + corpId: id, + success(res) { } + }) + }, + + + // 显示幸运购规则 + showRules: function () { + this.setData({ + showRules: true, + }); + }, + + // 关闭幸运购规则 + closeRules: function () { + this.setData({ + showRules: false, + }); + }, + + // 跳转 + go: function (e) { + var url = e.currentTarget.dataset.url; + getApp().goto(url); + }, + + // 查看奖励 + showReward: function () { + + this.getPrizes(this.data.luckGoInfo.type); + + }, + + // 关闭奖励 + closeReward: function () { + this.setData({ + showReward: false, + }); + }, + + + // 获取优惠券奖励和服务项目奖励 + getPrizes: function (type) { + // let currentItem = this.data.list.pageData[currentItemIndex]; + // let type = type; + let self = this; + let app = getApp(); + // 分割type字符串 + let typeArr = this.splitStringToArr(type); + let prizesArr = []; + let promiseArr = []; + typeArr.forEach(function (item) { + + let obj = {}; + obj.type = item; + + let promise = new Promise((resolve, reject) => { + switch (item) { + case 1: { //积分 + obj.name = '积分'; + obj.num = 'point'; + prizesArr.push(obj); + resolve(); + break; + }; + case 2: { //成长值 + obj.name = '成长值'; + obj.num = 'grow'; + prizesArr.push(obj); + resolve(); + break; + }; + case 3: { //优惠券 + app.request.promiseGet('/api/weshop/prom/luckyCoupon/page', { + data: { + store_id: os.stoid, + aid: self.data.luckGoInfo.id, + } + }).then(res => { + if (res.data.code == 0) { + obj.couponList = res.data.data.pageData; + prizesArr.push(obj); + resolve(); + }; + }); + break; + }; + case 4: { //服务项目 + app.request.promiseGet('/api/weshop/prom/luckyService/page', { + data: { + store_id: os.stoid, + aid: self.data.luckGoInfo.id, + } + }).then(res => { + if (res.data.code == 0) { + obj.serviceList = res.data.data.pageData; + prizesArr.push(obj); + resolve(); + }; + }); + break; + }; + case 5: { //预存金额 + obj.name = 'prestore_name'; + obj.num = 'prestore_money'; + prizesArr.push(obj); + resolve(); + break; + }; + }; + }); + + promiseArr.push(promise); + + + Promise.all(promiseArr).then(() => { + self.setData({ + prizesArr, + showReward: true, + }); + }); + + + + }); + + + + }, + + // 将type字符串分割成数组 + splitStringToArr: function (typeStr) { + var index; + var newTypeArr = []; + var typeStrArr = typeStr.split(','); + typeStrArr.forEach(function (item) { + index = parseInt(item); + newTypeArr.push(index); + }); + // console.log('newTypeArr', newTypeArr); + return newTypeArr; + }, + + + //弹出活动已经结束 + timeUp() { + wx.showToast({ + title: '本商品活动已经结束!', + icon: 'none', + }); + }, + + + // 预览海报 + previewPoster() { + wx.previewImage({ + current: this.data.shareImgPath, // 当前显示图片的http链接 + urls: [this.data.shareImgPath],// 需要预览的图片http链接列表 + }); + }, - con_weixin:function () { - var url=this.data.sys_switch.weapp_customertype_url; - var id=this.data.sys_switch.weapp_customertype_appid; - wx.openCustomerServiceChat({ - extInfo: {url: url}, - corpId: id, - success(res) {} - }) - }, - - - // 显示幸运购规则 - showRules: function() { - this.setData({ - showRules: true, - }); - }, - - // 关闭幸运购规则 - closeRules: function() { - this.setData({ - showRules: false, - }); - }, - - // 跳转 - go: function (e) { - var url = e.currentTarget.dataset.url; - getApp().goto(url); - }, - - // 查看奖励 - showReward: function() { - - this.getPrizes(this.data.luckGoInfo.type); - - }, - - // 关闭奖励 - closeReward: function() { - this.setData({ - showReward: false, - }); - }, - - - // 获取优惠券奖励和服务项目奖励 - getPrizes: function(type) { - // let currentItem = this.data.list.pageData[currentItemIndex]; - // let type = type; - let self = this; - let app = getApp(); - // 分割type字符串 - let typeArr = this.splitStringToArr(type); - let prizesArr = []; - let promiseArr = []; - typeArr.forEach(function(item) { - - let obj = {}; - obj.type = item; - - let promise = new Promise((resolve, reject) => { - switch(item) { - case 1: { //积分 - obj.name = '积分'; - obj.num = 'point'; - prizesArr.push(obj); - resolve(); - break; - }; - case 2: { //成长值 - obj.name = '成长值'; - obj.num = 'grow'; - prizesArr.push(obj); - resolve(); - break; - }; - case 3: { //优惠券 - app.request.promiseGet('/api/weshop/prom/luckyCoupon/page', { - data: { - store_id: os.stoid, - aid: self.data.luckGoInfo.id, - } - }).then(res => { - if(res.data.code == 0) { - obj.couponList = res.data.data.pageData; - prizesArr.push(obj); - resolve(); - }; - }); - break; - }; - case 4: { //服务项目 - app.request.promiseGet('/api/weshop/prom/luckyService/page', { - data: { - store_id: os.stoid, - aid: self.data.luckGoInfo.id, - } - }).then(res => { - if(res.data.code == 0) { - obj.serviceList = res.data.data.pageData; - prizesArr.push(obj); - resolve(); - }; - }); - break; - }; - case 5: { //预存金额 - obj.name = 'prestore_name'; - obj.num = 'prestore_money'; - prizesArr.push(obj); - resolve(); - break; - }; - }; - }); - - promiseArr.push(promise); - - - Promise.all(promiseArr).then(()=> { - self.setData({ - prizesArr, - showReward: true, - }); - }); - - - - }); - - - - }, - - // 将type字符串分割成数组 - splitStringToArr: function(typeStr) { - var index; - var newTypeArr = []; - var typeStrArr = typeStr.split(','); - typeStrArr.forEach(function(item) { - index = parseInt(item); - newTypeArr.push(index); - }); - // console.log('newTypeArr', newTypeArr); - return newTypeArr; - }, - - - //弹出活动已经结束 - timeUp() { - wx.showToast({ - title: '本商品活动已经结束!', - icon: 'none', - }); - }, - }); diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml index 8828fc8..88e5a26 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml @@ -200,7 +200,7 @@ @@ -1515,7 +1515,7 @@ - + diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss index cc55fd8..979fad7 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss @@ -1624,7 +1624,7 @@ left:31rpx;} /* 分享 */ .icon-share { - font-size: 46rpx; + font-size: 42rpx; color: #d60021; line-height: 1; } diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js index 71625c1..9223c31 100644 --- a/packageC/pages/presell/cart/cart2_pre.js +++ b/packageC/pages/presell/cart/cart2_pre.js @@ -233,7 +233,7 @@ Page({ th.setData({ user_addr: ie }); if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { th.setData({ add_back: 1 }); - if (this.data.bn_goods) th.calculatePrice2(); + if (th.data.bn_goods) th.calculatePrice2(); } }) //--更新默认地址--,看一下是不是跳到地址页面 diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index 284314f..7a49267 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -4019,6 +4019,14 @@ Page({ corpId: id, success(res) {} }) - } + }, + + // 预览海报 + previewPoster() { + wx.previewImage({ + current: this.data.shareImgPath, // 当前显示图片的http链接 + urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表 + }); + }, }); diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml index b26f03e..73a884f 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml +++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml @@ -121,7 +121,7 @@ @@ -527,7 +527,7 @@ {{filters.format_time(presellForm.end_time,2)}} 预售结束 {{filters.format_time(presellForm.delivery_date,2)}} 开始发货 - 付款{{presellForm.delivery_daynum}} 天后发货 + 付款{{presellForm.delivery_daynum}} 天内发货 @@ -937,7 +937,7 @@ - + diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.js b/packageC/pages/presell/pregoodsInfo/goodsInfo.js index ac5fbb2..412d4c7 100644 --- a/packageC/pages/presell/pregoodsInfo/goodsInfo.js +++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.js @@ -252,6 +252,9 @@ Page({ //------初始化加载---------- onLoad: function (t) { + if(!getApp().is_Single_page()){ + return false; + } var ee = this, that = ee, th = ee, pre_id = t.pre_id, gid = t.goods_id, diff --git a/packageD/ai_config/config.js b/packageD/ai_config/config.js new file mode 100644 index 0000000..ca88091 --- /dev/null +++ b/packageD/ai_config/config.js @@ -0,0 +1,21 @@ +/* + * @Author: your name + * @Date: 2022-02-26 09:44:36 + * @LastEditTime: 2022-02-26 09:48:10 + * @LastEditors: your name + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: \MShopWeApp\utils\ai_config\config.js + */ +let pluginGD = { + app_id: 'f1WwFd7W1lduYRQaUpDVdvi3w9infpUwe1o', + app_secret: 'ICYb2dw1QDCguPuArQKi4EegwKfyFzDbdh', + plugin_name: 'mtSkinSdk', + redirect_url: '/packageD/pages/AI-test-skin/index/aiskin', + share_qrcode: 'https://titan-h5.meitu.com/webar/eve/mini_skin_sdk/demo/mini_qrcode.jpg', + wx_api: { + getFileSystemManager: wx.getFileSystemManager, + }, +}; +export { + pluginGD, +}; diff --git a/packageD/pages/AI-test-skin/analyse/analyse.js b/packageD/pages/AI-test-skin/analyse/analyse.js index 0023c27..c6f5873 100644 --- a/packageD/pages/AI-test-skin/analyse/analyse.js +++ b/packageD/pages/AI-test-skin/analyse/analyse.js @@ -4,6 +4,14 @@ const request = app.request; const os = app.globalData; const setting = os.setting; const ut = require('../../../../utils/util'); +import { pluginGD } from '../../../ai_config/config' +// , +// "plugins": { +// "mtSkinSdk": { +// "version": "1.4.2", +// "provider": "wx3636b350f8484f20" +// } +// } Page({ /** @@ -11,171 +19,173 @@ Page({ */ data: { iurl: setting.imghost, - per:0, - timer:0, - img:null, - sourceimg:null, - err_map:null, + per: 0, + timer: 0, + img: null, + sourceimg: null, + err_map: null, + skin_type: 0, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - var th=this; - //设置错误码分析 - this.set_err_map(); - //进度条加载 - this.timer(); - //接口开始分析 - setTimeout(function () { - //th.analysis_img(); - //先检验一下图片 - th.img_check(function () { - - }); - },800) + if(this.data.skin_type){ + var plugin = requirePlugin('mtSkinSdk') + plugin.setConfig(pluginGD) + } + var th = this; + //设置错误码分析 + this.set_err_map(); + //进度条加载 + this.timer(); + //接口开始分析 + setTimeout(function () { + //先检验一下图片 + th.data.skin_type ? th.img_check_mt() : th.img_check_bd(); + }, 800) }, //定时器 - timer:function (func) { - var per=this.data.per+5; - var th=this; - if(per<96){ - th.setData({per:per}); - setTimeout(function () { - th.timer(); - },400) - } + timer: function (func) { + var per = this.data.per + 5; + var th = this; + if (per < 96) { + th.setData({ per: per }); + setTimeout(function () { + th.timer(); + }, 400) + } }, //错误码表 - set_err_map:function () { - var map={ - "2":"服务暂不可用", - "4":"集群超限额", - "6":"没有接口权限", - "17":"每天流量超限额", - "18":"QPS超限额", - "19":"请求总量超限额", - "100":"无效的access_token参数", - "110":"Access Token失效", - "111":" Access token过期", - "222001":"必要参数未传入", - "222002":"参数格式错误", - "222003":"参数格式错误", - "222004":"参数格式错误", - "222005":"参数格式错误", - "222006":"参数格式错误", - "222007":"参数格式错误", - "222008":"参数格式错误", - "222009":"参数格式错误", - "222010":"参数格式错误", - "222011":"参数格式错误", - "222012":"参数格式错误", - "222013":"参数格式错误", - "222014":"参数格式错误", - "222015":"参数格式错误", - "222016":"参数格式错误", - "222017":"参数格式错误", - "222018":"参数格式错误", - "222019":"参数格式错误", - "222020":"参数格式错误", - "222021":"参数格式错误", - "222022":"身份证号不符合要求,备注:中国大陆身份证号的每一位数字都有其生成规则,不可随意填写。", - "222023":"参数格式错误", - "222024":"参数格式错误", - "222025":"参数格式错误", - "222026":"参数格式错误", - "222027":"验证码长度错误(最小值大于最大值)", - "222028":"参数格式错误", - "222029":"参数格式错误", - "222030":"参数格式错误", - "222039":"参数格式错误", - "222200":"该接口需使用application/json的格式进行请求", - "222201":"服务端请求失败", - "222202":"图片中没有人脸", - "222203":"无法解析人脸", - "222204":"从图片的url下载图片失败", - "222205":"服务端请求失败", - "222206":"服务端请求失败", - "222207":"未找到匹配的用户", - "222208":"图片的数量错误", - "222209":"face token不存在", - "222210":"人脸库中用户下的人脸数目超过限制", - "222300":"人脸图片添加失败", - "222301":"获取人脸图片失败", - "222302":"服务端请求失败", - "222303":"获取人脸图片失败", - "222152":"人脸属性编辑,target参数错误", - "222514":"人脸属性编辑v2调用服务失败,请重试", - "223100":"操作的用户组不存在", - "223101":"该用户组已存在", - "223102":"找不到该用户", - "223103":"找不到该用户", - "223104":"group_list包含组数量过多", - "223105":"该人脸已存在", - "223106":"该人脸不存在", - "223107":"人脸库中人脸复制时源组与目标组的scene_type不同", - "223110":"uid_list包含数量过多", - "223111":"目标用户组不存在", - "223112":"quality_conf格式不正确", - "223113":"人脸有被遮挡", - "223114":"人脸模糊", - "223115":"人脸光照不好", - "223116":"人脸不完整", - "223117":"app_list包含app数量过多", - "223118":"质量控制项错误", - "223119":"活体控制项错误", - "223120":"活体检测未通过", - "223121":"质量检测未通过 左眼遮挡程度过高", - "223122":"质量检测未通过 右眼遮挡程度过高", - "223123":"质量检测未通过 左脸遮挡程度过高", - "223124":"质量检测未通过 右脸遮挡程度过高", - "223125":"质量检测未通过 下巴遮挡程度过高", - "223126":"质量检测未通过 鼻子遮挡程度过高", - "223127":"质量检测未通过 嘴巴遮挡程度过高", - "222901":"参数校验初始化失败", - "222902":"参数校验初始化失败", - "222903":"参数校验初始化失败", - "222904":"参数校验初始化失败", - "222905":"接口初始化失败", - "222906":"接口初始化失败", - "222907":"缓存处理失败", - "222908":"缓存处理失败", - "222909":"缓存处理失败", - "222910":"数据存储处理失败", - "222911":"数据存储处理失败", - "222912":"数据存储处理失败", - "222913":"接口初始化失败", - "222914":"接口初始化失败", - "222915":"后端服务连接失败", - "222916":"后端服务连接失败", - "222304":"图片尺寸太大", - "222305":"当前版本不支持图片存储", - "223128":"正在清理该用户组的数据", - "223136":"该组内存在关联图片,无法新建相同名称组", - "222361":"公安服务连接失败", - "222046":"参数格式错误", - "222101":"参数格式错误", - "222102":"参数格式错误", - "222307":"图片非法 鉴黄未通过", - "222308":"图片非法 含有政治敏感人物", - "222211":"人脸融合失败 模板图质量不合格", - "222212":"人脸融合失败", - "223129":"人脸未面向正前方(人脸的角度信息大于30度)", - "223130":"spoofing_control参数格式错误", - "223131":"合成图检测未通过", - "223201":"请求参数scene_type 格式错误", - "223202":"识别时请求的scene_type与group设置的scene_type不匹配", - } - this.setData({err_map:map}); + set_err_map: function () { + var map = { + "2": "服务暂不可用", + "4": "集群超限额", + "6": "没有接口权限", + "17": "每天流量超限额", + "18": "QPS超限额", + "19": "请求总量超限额", + "100": "无效的access_token参数", + "110": "Access Token失效", + "111": " Access token过期", + "222001": "必要参数未传入", + "222002": "参数格式错误", + "222003": "参数格式错误", + "222004": "参数格式错误", + "222005": "参数格式错误", + "222006": "参数格式错误", + "222007": "参数格式错误", + "222008": "参数格式错误", + "222009": "参数格式错误", + "222010": "参数格式错误", + "222011": "参数格式错误", + "222012": "参数格式错误", + "222013": "参数格式错误", + "222014": "参数格式错误", + "222015": "参数格式错误", + "222016": "参数格式错误", + "222017": "参数格式错误", + "222018": "参数格式错误", + "222019": "参数格式错误", + "222020": "参数格式错误", + "222021": "参数格式错误", + "222022": "身份证号不符合要求,备注:中国大陆身份证号的每一位数字都有其生成规则,不可随意填写。", + "222023": "参数格式错误", + "222024": "参数格式错误", + "222025": "参数格式错误", + "222026": "参数格式错误", + "222027": "验证码长度错误(最小值大于最大值)", + "222028": "参数格式错误", + "222029": "参数格式错误", + "222030": "参数格式错误", + "222039": "参数格式错误", + "222200": "该接口需使用application/json的格式进行请求", + "222201": "服务端请求失败", + "222202": "未识别到单个人脸",//未识别到单个人脸 + "222203": "无法解析人脸", + "222204": "从图片的url下载图片失败", + "222205": "服务端请求失败", + "222206": "服务端请求失败", + "222207": "未找到匹配的用户", + "222208": "图片的数量错误", + "222209": "face token不存在", + "222210": "人脸库中用户下的人脸数目超过限制", + "222300": "人脸图片添加失败", + "222301": "获取人脸图片失败", + "222302": "服务端请求失败", + "222303": "获取人脸图片失败", + "222152": "人脸属性编辑,target参数错误", + "222514": "人脸属性编辑v2调用服务失败,请重试", + "223100": "操作的用户组不存在", + "223101": "该用户组已存在", + "223102": "找不到该用户", + "223103": "找不到该用户", + "223104": "group_list包含组数量过多", + "223105": "该人脸已存在", + "223106": "该人脸不存在", + "223107": "人脸库中人脸复制时源组与目标组的scene_type不同", + "223110": "uid_list包含数量过多", + "223111": "目标用户组不存在", + "223112": "quality_conf格式不正确", + "223113": "人脸有被遮挡", + "223114": "人脸模糊", + "223115": "人脸光照不好", + "223116": "人脸不完整", + "223117": "app_list包含app数量过多", + "223118": "质量控制项错误", + "223119": "活体控制项错误", + "223120": "活体检测未通过", + "223121": "质量检测未通过 左眼遮挡程度过高", + "223122": "质量检测未通过 右眼遮挡程度过高", + "223123": "质量检测未通过 左脸遮挡程度过高", + "223124": "质量检测未通过 右脸遮挡程度过高", + "223125": "质量检测未通过 下巴遮挡程度过高", + "223126": "质量检测未通过 鼻子遮挡程度过高", + "223127": "质量检测未通过 嘴巴遮挡程度过高", + "222901": "参数校验初始化失败", + "222902": "参数校验初始化失败", + "222903": "参数校验初始化失败", + "222904": "参数校验初始化失败", + "222905": "接口初始化失败", + "222906": "接口初始化失败", + "222907": "缓存处理失败", + "222908": "缓存处理失败", + "222909": "缓存处理失败", + "222910": "数据存储处理失败", + "222911": "数据存储处理失败", + "222912": "数据存储处理失败", + "222913": "接口初始化失败", + "222914": "接口初始化失败", + "222915": "后端服务连接失败", + "222916": "后端服务连接失败", + "222304": "图片尺寸太大", + "222305": "当前版本不支持图片存储", + "223128": "正在清理该用户组的数据", + "223136": "该组内存在关联图片,无法新建相同名称组", + "222361": "公安服务连接失败", + "222046": "参数格式错误", + "222101": "参数格式错误", + "222102": "参数格式错误", + "222307": "图片非法 鉴黄未通过", + "222308": "图片非法 含有政治敏感人物", + "222211": "人脸融合失败 模板图质量不合格", + "222212": "人脸融合失败", + "223129": "人脸未面向正前方(人脸的角度信息大于30度)", + "223130": "spoofing_control参数格式错误", + "223131": "合成图检测未通过", + "223201": "请求参数scene_type 格式错误", + "223202": "识别时请求的scene_type与group设置的scene_type不匹配", + } + this.setData({ err_map: map }); }, /** * 生命周期函数--监听页面显示 */ - onShow: function (){ }, + onShow: function () { }, /** * 生命周期函数--监听页面隐藏 @@ -199,163 +209,367 @@ Page({ }, - //检查图片有没有OK - img_check:function (func) { - var th=this; - var data={ + //检查图片有没有OK 百度 + img_check_bd: function (func) { + var th = this; + var data = { "appid": "25521854", "image": getApp().globalData.face_SourceImg, "face_field": "age,expression,face_shape,gender,glasses,landmark,landmark150,quality,eye_status,emotion,face_type,mask,spoofing", - "image_type": "URL" + "image_type": "URL", + "store_id":setting.stoid } - //开始调用接口,进行对图片进行判断是否符合标准 - this.json_post("/api/weshop/baidubce/face/skindetect",data,function (res) { - if(res.data.code==0){ + //开始调用百度接口,进行对图片进行判断是否符合标准 + this.json_post("/api/weshop/baidubce/face/skindetect", data, function (res) { + if (res.data.code == 0) { //检查的字段存储 - var check_data=th.data.check_data=res.data.data; - check_data=check_data.face_list[0]; + + var check_data = th.data.check_data = res.data.data; + check_data = check_data.face_list[0]; + if(!check_data) { + getApp().showWarning('网络繁忙,请稍后再试'); + return false; + } + let fail_result = new Array(); + console.log(check_data); //检查睁眼闭眼 - var eye_status=check_data.eye_status; - if(eye_status.left_eye>0.1 || eye_status.right_eye>0.1) { - var msg="未闭眼拍照"; - th.go_error(msg); - return false; + var eye_status = check_data.eye_status; + console.log('eye_status',eye_status); + if (eye_status.left_eye > 0.5 || eye_status.right_eye > 0.5) { + // var msg = "未闭眼拍照"; + // th.go_error(msg); + // return false; + fail_result.push({ + type: 1, + reason: "未闭眼拍摄" + }) } //检查是不是有带眼镜 - if(check_data.glasses.type!='none'){ - var msg="有佩戴眼镜"; - th.go_error(msg); - return false; - } - //检查头部的角度 - var angle=check_data.angle; - if(Math.abs(angle.Pitch)>20) { - var msg="头部的俯仰角度过大"; - th.go_error(msg); - return false; + if (check_data.glasses.type != 'none') { + // var msg = "有佩戴眼镜"; + // th.go_error(msg); + // return false; + fail_result.push({ + type: 2, + reason: "未摘下眼镜拍摄" + }) } - if(Math.abs(angle.Roll)>20) { - var msg="头部的平面角度过大"; - th.go_error(msg); - return false; - } - if(Math.abs(angle.Yaw)>20) { - var msg="头部的左右角度过大"; - th.go_error(msg); - return false; + var quality = check_data.quality; + //检查框里人脸情况 + if (quality.completeness = 0) { + // var msg = "人脸未显示完整"; + // th.go_error(msg); + // return false; + fail_result.push({ + type: 3, + reason: "未识别到单个人脸" + }) } - var quality=check_data.quality; - if(quality.blur>0.7){ - var msg="图片模糊"; - th.go_error(msg); - return false; + //检查环境情况 + if (quality.blur > 0.7 || quality.illumination < 40) { + // var msg = "图片模糊"; + // th.go_error(msg); + // return false; + fail_result.push({ + type: 4, + reason: "质量检测未通过" + }) } + + // if (Math.abs(angle.Roll) > 20) { + // var msg = "头部的平面角度过大"; + // th.go_error(msg); + // return false; + // } + // if (Math.abs(angle.Yaw) > 20) { + // var msg = "头部的左右角度过大"; + // th.go_error(msg); + // return false; + // } + //开始检查遮挡 - var occlusion=check_data.quality.occlusion; - if(occlusion.left_eye >0.6){ - var msg="左眼被遮挡"; - th.go_error(msg); - return false; + var zhe_dnag = 0; + var occlusion = check_data.quality.occlusion; + if (occlusion.left_eye > 0.6) { + // var msg = "左眼被遮挡"; + // th.go_error(msg); + // return false; + zhe_dnag = 1; } - if(occlusion.right_eye>0.6){ - var msg="右眼被遮挡"; - th.go_error(msg); - return false; + if (occlusion.right_eye > 0.6) { + // var msg = "右眼被遮挡"; + // th.go_error(msg); + // return false; + zhe_dnag = 1; } - if(occlusion.nose>0.7){ - var msg="鼻子被遮挡"; - th.go_error(msg); - return false; + if (occlusion.nose > 0.7) { + // var msg = "鼻子被遮挡"; + // th.go_error(msg); + // return false; + zhe_dnag = 1; } - if(occlusion.mouth>0.7){ - var msg="嘴巴被遮挡"; - th.go_error(msg); - return false; + if (occlusion.mouth > 0.7) { + // var msg = "嘴巴被遮挡"; + // th.go_error(msg); + // return false; + zhe_dnag = 1; } - if(occlusion.left_cheek >0.8){ - var msg="左脸颊被遮挡"; - th.go_error(msg); - return false; + if (occlusion.left_cheek > 0.8) { + // var msg = "左脸颊被遮挡"; + // th.go_error(msg); + // return false; + zhe_dnag = 1; } - if(occlusion.right_cheek >0.8){ - var msg="右脸颊被遮挡"; - th.go_error(msg); - return false; + if (occlusion.right_cheek > 0.8) { + // var msg = "右脸颊被遮挡"; + // th.go_error(msg); + // return false; + zhe_dnag = 1; } - if(occlusion.chin_contour >0.6){ - var msg="下巴颊被遮挡"; - th.go_error(msg); - return false; + if (occlusion.chin_contour > 0.6) { + // var msg = "下巴颊被遮挡"; + // th.go_error(msg); + // return false; + zhe_dnag = 1; } - if(quality.illumination<40){ - var msg="图像光照不足"; - th.go_error(msg); - return false; + if (zhe_dnag) { + fail_result.push({ + type: 7, + reason: "脸部有遮挡物" + }) + } + //检查头部的角度 + var angle = check_data.angle; + if (Math.abs(angle.Pitch) > 20 || Math.abs(angle.Roll) > 20 || Math.abs(angle.Yaw) > 20) { + // var msg = "头部的俯仰角度过大"; + // th.go_error(msg); + // return false; + fail_result.push({ + type: 8, + reason: "未保持正脸拍摄" + }) } - if(quality.completeness=0){ - var msg="人脸未显示完整"; - th.go_error(msg); + // if (quality.illumination < 40) { + // var msg = "图像光照不足"; + // th.go_error(msg); + // return false; + // } + if (fail_result.length > 0) { + fail_result = JSON.stringify(fail_result); + th.go_error(fail_result); return false; } //-- 开始调用分析的接口 -- - var face_token=check_data.face_token; - var data={ + var face_token = check_data.face_token; + var data = { "image": face_token, "face_field": "color,smooth,acnespotmole,wrinkle,eyesattr,blackheadpore,skinface,skinquality", "image_type": "FACE_TOKEN" } - th.analysis_img(data); - }else{ - var msg=th.data.err_map[res.data.code+""]; - th.go_error(msg); + th.analyse_by_bd(data); + } else { + var msg = th.data.err_map[res.data.code + ""]; + th.go_error1(msg); } }) }, - - //跳转到错误页面 - go_error:function (msg) { - let url = "/packageB/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页 - wx.redirectTo({ - url: url - }); - }, + //检查图片有没有OK 美图 + img_check_mt() { + let img_info = getApp().globalData.skin_img_info; + var plugin = requirePlugin('mtSkinSdk'); + console.log('plugin'); + let th = this; + plugin.facePoseCorrect({ + path: img_info['path'], + size: img_info['size'], + success(res) { + console.log('=========姿态校正 成功==========') + console.log('姿态校正结果', res) + let fail_result = new Array(); + let analyse_info = res.data; + //检查闭眼情况 + if (analyse_info.analyse_info) { + //检查睁眼闭眼 + let { left, right } = analyse_info.analyse_info; + if (left !== 2 && right !== 2) { + fail_result.push({ + type: 1, + reason: "未闭眼拍摄" + }) + } + } + //检查佩戴情况 + if (analyse_info.faceGlasses) { + let { none, normal, sunglasses } = analyse_info.faceGlasses; + if (normal > 0.8 || sunglasses > 0.8 || none < 0.1) { + fail_result.push({ + type: 2, + reason: "未摘下眼镜拍摄" + }) + } + } + //检查框里人脸情况 + if (analyse_info.faceOutDetect.outBound == 1) { + fail_result.push({ + type: 3, + reason: "未识别到单个人脸" + }) + } - analysis_img:function (data) { - var th=this; + //检查环境情况 + if (analyse_info.faceQuality) { + let { bright, blur } = analyse_info.faceQuality; + if (bright > 80 || bright < 20 || blur < 20) { + fail_result.push({ + type: 4, + reason: "质量检测未通过" + }) + } + } + //检查距离 + if (analyse_info.faceRatio < 0.2) { + fail_result.push({ + type: 5, + reason: "脸部与摄像头距离过远" + }) + } + if (analyse_info.faceRatio > 0.8) { + fail_result.push({ + type: 6, + reason: "脸部与摄像头距离过近" + }) + + } + //检查遮挡物 + if (analyse_info.faceVisibility) { + let fail = Object.keys(analyse_info.faceVisibility).filter(key => { + return analyse_info.faceVisibility[key] <= 80; + }) + console.log('fail', fail); + if (fail.length > 0) { + fail_result.push({ + type: 7, + reason: "脸部有遮挡物" + }) + } + } + if (analyse_info.facePoseEuler) { + let { pitch, roll, yaw } = analyse_info.facePoseEuler; + if (pitch > 20 || roll > 20 || yaw > 20) { + fail_result.push({ + type: 8, + reason: "未保持正脸拍摄" + }) + } + } + if (fail_result.length > 0) { + fail_result = JSON.stringify(fail_result); + th.go_error(fail_result); + return false; + } + th.analyse_by_mt(img_info,analyse_info); + }, + fail(err) { + console.log(err); + th.go_error1('识别有误,请重试'); + return false; + } + }) + + }, + //美图测肤接口 + analyse_by_mt(img_info,analyse_info) { + let th = this; + var plugin = requirePlugin('mtSkinSdk') + plugin.detectImage({ + path: img_info['path'], + size: img_info['size'], + success(res) { + console.log('=========用户传图片链接获取检测结果 成功==========') + console.log('检测结果', res); + let analyse_data = res.data.face_attributes; + analyse_data['face_rectangle'] = res.data.face_rectangle; + let req_data = { + store_id: setting.stoid, + user_id: getApp().globalData.user_id, + img: getApp().globalData.face_img, + sourceimg: getApp().globalData.face_SourceImg, + addtime: ut.gettimestamp(), + resultjson: JSON.stringify(analyse_data), + detectjson: JSON.stringify(analyse_info), + skin_type: 1, + } + //要保存一下分析的结果 + th.json_post("/api/weshop/face/storeSkinface/save", req_data, function (res) { + if (res.data.code == 0) { + let url = "/packageD/pages/AI-test-skin/success_result/success_result?id=" + res.data.data.id; //跳到分析页 + wx.redirectTo({ + url: url + }) + } else { + getApp().showWarning("保存失败"); + } + }) + }, + fail(err) { + console.error('=========用户传图片链接获取检测结果 失败==========') + console.log('error', err) + getApp().showWarning(err); + } + }) + }, + //百度测肤接口 + analyse_by_bd: function (data) { + var th = this; //开始调用接口,进行分析 - this.json_post("/api/weshop/baidubce/face/skinAnalyze",data,function (res) { - if(res.data.code==0){ - getApp().globalData.face_result=res.data.data; - var req_data={ - store_id:setting.stoid, - user_id:getApp().globalData.user_id, - img:getApp().globalData.face_img, - sourceimg:getApp().globalData.face_SourceImg, - addtime:ut.gettimestamp(), - resultjson:JSON.stringify(res.data.data), - detectjson:JSON.stringify(th.data.check_data) + this.json_post("/api/weshop/baidubce/face/skinAnalyze", data, function (res) { + if (res.data.code == 0) { + getApp().globalData.face_result = res.data.data; + var req_data = { + store_id: setting.stoid, + user_id: getApp().globalData.user_id, + img: getApp().globalData.face_img, + sourceimg: getApp().globalData.face_SourceImg, + addtime: ut.gettimestamp(), + resultjson: JSON.stringify(res.data.data), + detectjson: JSON.stringify(th.data.check_data), + skin_type: 0, } //要保存一下分析的结果 - th.json_post("/api/weshop/face/storeSkinface/save",req_data,function (res) { - if(res.data.code==0){ - let url = "/packageB/pages/AI-test-skin/success_result/success_result?id="+res.data.data.id; //跳到分析页 + th.json_post("/api/weshop/face/storeSkinface/save", req_data, function (res) { + if (res.data.code == 0) { + let url = "/packageD/pages/AI-test-skin/success_result/success_result?id=" + res.data.data.id; //跳到分析页 wx.redirectTo({ url: url }) - }else{ + } else { getApp().showWarning("保存失败"); } }) - }else{ - var msg=th.data.err_map[res.data.code+""]; - let url = "/packageB/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页 + } else { + var msg = th.data.err_map[res.data.code + ""]; + let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页 wx.redirectTo({ - url: url + url: url }) } }) }, + //跳转到错误页面 美图 + go_error: function (fail_result) { + let url = `/packageD/pages/AI-test-skin/fail_result/fail_result?fail_result=${fail_result}`; //跳到分析页 + wx.redirectTo({ + url: url + }); + }, + //跳转到错误页面 + go_error1: function (msg) { + let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页 + wx.redirectTo({ + url: url + }); + }, /** * @param {Object} url //url地址 @@ -363,10 +577,10 @@ Page({ * @param {Object} succ //成功的回调 * @param {Object} fail //失败的回调 */ - json_post:function(url,data,succ,fail,mathod){ - var Mathod="POST"; + json_post: function (url, data, succ, fail, mathod) { + var Mathod = "POST"; if (mathod) Mathod = mathod; - if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; + if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url; var str = JSON.stringify(data); wx.request({ url: url, @@ -375,10 +589,8 @@ Page({ header: { 'content-type': 'application/json' },// 设置请求的 header - success: function (res) {succ(res); }, - fail:function(res){fail(res);} + success: function (res) { succ(res); }, + fail: function (res) { fail(res); } }) }, - - }) \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/analyse/analyse.json b/packageD/pages/AI-test-skin/analyse/analyse.json index 8835af0..a9c180d 100644 --- a/packageD/pages/AI-test-skin/analyse/analyse.json +++ b/packageD/pages/AI-test-skin/analyse/analyse.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "navigationBarTitleText": "测肤报告" } \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/analyse/analyse.wxml b/packageD/pages/AI-test-skin/analyse/analyse.wxml index 475638a..60b0fda 100644 --- a/packageD/pages/AI-test-skin/analyse/analyse.wxml +++ b/packageD/pages/AI-test-skin/analyse/analyse.wxml @@ -1,7 +1,10 @@ - - - 正在分析... - + + + + + 正在分析... + diff --git a/packageD/pages/AI-test-skin/analyse/analyse.wxss b/packageD/pages/AI-test-skin/analyse/analyse.wxss index ac83838..426f8a6 100644 --- a/packageD/pages/AI-test-skin/analyse/analyse.wxss +++ b/packageD/pages/AI-test-skin/analyse/analyse.wxss @@ -25,18 +25,17 @@ page { } .img { - background: url("https://mshopimg.yolipai.net//miniapp/images/skinimg/11.png"); margin-top: 15%; display: inline-block; width: 350px; height: 350px; - transform: scale(0.55); - animation: 1s mymove infinite steps(27, end); + transform: scale(0.4); + animation: 2s mymove infinite steps(27, end); } .progress { margin-top: 3%; - width: 60%; + width: 48%; /* text-align: center; */ margin-left: 50%; transform: translateX(-50%); diff --git a/packageD/pages/AI-test-skin/fail_result/fail_result.js b/packageD/pages/AI-test-skin/fail_result/fail_result.js index 3a0769c..dad8387 100644 --- a/packageD/pages/AI-test-skin/fail_result/fail_result.js +++ b/packageD/pages/AI-test-skin/fail_result/fail_result.js @@ -1,7 +1,7 @@ /* * @Author: your name * @Date: 2022-02-15 10:01:57 - * @LastEditTime: 2022-02-16 15:40:54 + * @LastEditTime: 2022-02-28 15:51:37 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AEet urkl * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\shoot_notice\shoot_notice.js @@ -20,15 +20,26 @@ Page({ data: { iurl: setting.imghost, msg:null, + fail_result:new Array(), //失败原因 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - var msg=options.msg; - msg=decodeURIComponent(msg); - this.setData({msg:msg}); + if(options?.fail_result){ + var fail_result = JSON.parse(options.fail_result); + this.setData({ + fail_result, + }) + } + if(options?.msg){ + this.setData({ + msg:options.msg + }) + } + // msg=decodeURIComponent(msg); + // this.setData({msg:msg}); }, /** @@ -53,7 +64,7 @@ Page({ }, //从相册中选择图片 back_to:function () { - let url = "/packageB/pages/AI-test-skin/shoot_notice/shoot_notice"; + let url = "/packageD/pages/AI-test-skin/shoot_notice/shoot_notice"; app.goto(url); }, diff --git a/packageD/pages/AI-test-skin/fail_result/fail_result.wxml b/packageD/pages/AI-test-skin/fail_result/fail_result.wxml index 6849bab..efdd6a4 100644 --- a/packageD/pages/AI-test-skin/fail_result/fail_result.wxml +++ b/packageD/pages/AI-test-skin/fail_result/fail_result.wxml @@ -3,20 +3,32 @@ - + - 上传图片符合要求 + 上传图片不符合要求 请重新更换图片获取相关检测 - 失败原因: - - - {{msg}} - + 失败原因: + + + + + {{item.reason}} + + + + + + + + {{msg}} + + + diff --git a/packageD/pages/AI-test-skin/fail_result/fail_result.wxss b/packageD/pages/AI-test-skin/fail_result/fail_result.wxss index d09a20f..51a0f2e 100644 --- a/packageD/pages/AI-test-skin/fail_result/fail_result.wxss +++ b/packageD/pages/AI-test-skin/fail_result/fail_result.wxss @@ -25,10 +25,10 @@ page { margin: 70rpx 0 30rpx 50%; transform: translateX(-50%); background: #4bd6df; - padding: 20rpx; - width: 50%; + padding: 15rpx 10rpx; + width: 46%; text-align: center; - border-radius: 40rpx; + border-radius: 50rpx; color: #fff; } .btn_fixed { @@ -60,43 +60,10 @@ page { justify-content: center; } .ac{align-items: center} - -@font-face { - font-family: 'iconfont'; - /* project id 2125414 */ - src: url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.eot'); - src: url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.eot?#iefix') format('embedded-opentype'), - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.woff2') format('woff2'), - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.woff') format('woff'), - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.ttf') format('truetype'), - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.svg#iconfont') format('svg'); -} - -.icon-pic:before { - content: "\e620"; -} - .t_c{text-align: center} -@font-face { - font-family: "iconfont"; /* Project id 3188718 */ - src: url('iconfont.woff2?t=1645080046840') format('woff2'), - url('iconfont.woff?t=1645080046840') format('woff'), - url('iconfont.ttf?t=1645080046840') format('truetype'); -} -.icon-tupian:before { - content: "\e997"; -} - -.icon-account:before { - content: "\e6a3"; -} - -.icon-prompt-filling:before { - content: "\e68b"; -} diff --git a/packageD/pages/AI-test-skin/history_record/history_record.js b/packageD/pages/AI-test-skin/history_record/history_record.js index dac750e..598d574 100644 --- a/packageD/pages/AI-test-skin/history_record/history_record.js +++ b/packageD/pages/AI-test-skin/history_record/history_record.js @@ -177,69 +177,126 @@ Page({ return initChart; } }, + history: [], + page: 1, + no_more: 0, + isLoading: 0, + is_get: 0, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + this.getHistoryData(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + time_sort(data) { + let arr = this.data.history; + for (let i = 0; i < data.length; i++) { + let history = data[i]; + let id = history.id; + let now = new Date(history['addtime'] * 1000); + let year = now.getFullYear(); //年 + let month = (now.getMonth() + 1).toString().padStart(2, 0); //月 + let day = (now.getDate()).toString().padStart(2, 0); //日 + let hour = (now.getHours()).toString().padStart(2, 0); //时 + let minute = (now.getMinutes()).toString().padStart(2, 0); //分 + let history_time = `${year}年${month}月`; + let time = `${year}/${month}/${day} ${hour}:${minute}`; + let time_obj = { + history_time, + time_arr: new Array(), + }; + let obj = { + time, + id, + }; + if (arr.length > 0) { + let index = arr.findIndex(item => { + return item['history_time'] === history_time; + }) + if (index > -1) { + arr[index]['time_arr'].push(obj); + } else { + time_obj['time_arr'].push(obj); + arr.push(time_obj); + } + } else { + time_obj['time_arr'].push(obj); + arr.push(time_obj); + } + } + function _sort_by_history_time (property){ + return function(a,b){ + let val1 = a[property]; + let val2 = b[property]; + if(val2 > val1){ + return 1 + }else if(val2 < val1){ + return -1 + }else{ + return 0 + } + } + } + arr.sort(_sort_by_history_time('history_time')); + return arr; + }, + bindscrolltolower(){ + console.log(111); + }, + + async getHistoryData() { + if (this.data.no_more) return false; + if (this.data.isLoading) return false; + this.data.isLoading = 1; + let history = this.data.history; let url = `/api/weshop/face/storeSkinface/page`; - app.request.promiseGet(url, { + const { data: res } = await request.promiseGet(url, { isShowLoading: true, data: { store_id: setting.stoid, user_id: os.user_id, + page: this.data.page, + pageSize:20 } - }).then(res => { - console.log('111111111', res); - if (ut.ajax_ok(res)) { - let data = res.data.data.pageData; - let arr = []; - for (let i = 0; i < data.length; i++) { - let history = data[i]; - let id = history.id; - let now = new Date(history['addtime'] * 1000); - let year = now.getFullYear(); //年 - let month = (now.getMonth() + 1).toString().padStart(2, 0); //月 - let day = (now.getDate()).toString().padStart(2, 0); //日 - let hour = (now.getHours()).toString().padStart(2, 0); //时 - let minute = (now.getMinutes()).toString().padStart(2, 0); //分 - let history_time = `${year}年${month}月`; - let time = `${year}/${month}/${day} ${hour}:${minute}`; - let time_obj = { - history_time, - time_arr: new Array(), - }; - if (arr.length > 0) { - let index = arr.findIndex(item => { - return item['history_time'] === history_time; - }) - if (index > -1) { - let obj = { - time, - id, - }; - arr[index]['time_arr'].push(obj); - } else { - arr.push(time_obj); - } - } else { - arr.push(time_obj); - } - } + }); + // initChart.setOption(option); + if (res.code == 0 && res.data.pageData.length > 0) { + history = this.time_sort(res.data.pageData); + if(res.data.pageData.length >= res.data.total){ this.setData({ - history: arr, + no_more: 1, }) - initChart.setOption(option); } - - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { + this.setData({ + history, + isLoading: 0, + is_get: 1, + }) + } else { + if (res.data.page > 1) { + this.setData({ + history, + no_more: 1, + isLoading: 0, + is_get: 1, + }) + } else { + this.setData({ + history: [], + is_get: 1, + }) + } + } }, @@ -247,12 +304,12 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - setTimeout(() => { - - }, 1000); + }, go_result(e) { - + let id = e.currentTarget.dataset.id; + let url =`/packageD/pages/AI-test-skin/success_result/success_result?id=${id}`; + app.goto(url); }, /** @@ -280,7 +337,8 @@ Page({ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + this.data.page++; + this.getHistoryData(); }, /** diff --git a/packageD/pages/AI-test-skin/history_record/history_record.json b/packageD/pages/AI-test-skin/history_record/history_record.json index 3ea23fa..3a9565f 100644 --- a/packageD/pages/AI-test-skin/history_record/history_record.json +++ b/packageD/pages/AI-test-skin/history_record/history_record.json @@ -1,6 +1,7 @@ { "navigationBarTitleText": "历史变化", "usingComponents": { - "ec-canvas": "../../../components/ec-canvas/ec-canvas" + "ec-canvas": "../../../components/ec-canvas/ec-canvas", + "nodata": "/components/nodata/nodata" } } \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/history_record/history_record.wxml b/packageD/pages/AI-test-skin/history_record/history_record.wxml index c0211fa..4fd17de 100644 --- a/packageD/pages/AI-test-skin/history_record/history_record.wxml +++ b/packageD/pages/AI-test-skin/history_record/history_record.wxml @@ -1,22 +1,25 @@ - 历史分析 - - - + + 历史分析 + + + + + + 注:请确保多次拍摄姿态和环境光线一致。拍摄姿态的偏移、环境光线变化或者皮肤状态变化都可能导致分数较大波动。 + - - 注:请确保多次拍摄姿态和环境光线一致。拍摄姿态的偏移、环境光线变化或者皮肤状态变化都可能导致分数较大波动。 - - 历史报告 - + 历史报告 - {{item.time}} - - {{subitem}} - 去查看 + {{item.history_time}} + + {{subitem.time}} + 去查看 + - 没有更多了 - + \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/history_record/history_record.wxss b/packageD/pages/AI-test-skin/history_record/history_record.wxss index a7a41fd..f5d96b0 100644 --- a/packageD/pages/AI-test-skin/history_record/history_record.wxss +++ b/packageD/pages/AI-test-skin/history_record/history_record.wxss @@ -4,10 +4,18 @@ page { height: 100%; } -.mgv5 { +.mgb5 { margin-top: 5%; margin-bottom: 5%; } +.txt-center { + text-align: center; +} +.no-more { + font-size: 24rpx; + line-height: 3; + color: #bbb; +} .content { padding: 5%; diff --git a/packageD/pages/AI-test-skin/index/aiskin.js b/packageD/pages/AI-test-skin/index/aiskin.js index fa0d8ce..1b36232 100644 --- a/packageD/pages/AI-test-skin/index/aiskin.js +++ b/packageD/pages/AI-test-skin/index/aiskin.js @@ -43,7 +43,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + this.getHistoryData(); }, /** @@ -54,23 +54,27 @@ Page({ }, goto(e) { - var user=getApp().globalData.userInfo; - if(!user){ - wx.showToast({ - title: "请先授权登陆", - icon: 'none', - duration: 2000 - }); - - setTimeout(function () { - let url = "/pages/togoin/togoin"; - app.goto(url); - },1000) - return false; - } - let url = e.currentTarget.dataset.url; - app.goto(url); + this.check_num(function () { + var user=getApp().globalData.userInfo; + if(!user){ + wx.showToast({ + title: "请先授权登陆", + icon: 'none', + duration: 2000 + }); + + setTimeout(function () { + let url = "/pages/togoin/togoin"; + app.goto(url); + },1000) + return false; + } + + let url = e.currentTarget.dataset.url; + app.goto(url); + }) + }, /** @@ -99,5 +103,49 @@ Page({ */ onShareAppMessage: function () { + }, + + check_num:function (func) { + //判断右没有开AI测肤 + getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{ + if(rs.data.code!=0 || !rs.data.data){ + wx.showToast({ + title: "未开通测肤功能,请联系商家", + icon: 'none', + duration: 3000 + }) + }else if(!rs.data.data.skin_num || rs.data.data.skin_num<=0){ + wx.showToast({ + title: "测肤功能的使用次数已经达到上限,请联系商家", + icon: 'none', + duration: 3000 + }) + }else{ + func(); + } + }) + }, + + async getHistoryData() { + if (!getApp().globalData.user_id) return false; + if (this.data.show_his) return false; + + let history = this.data.history; + let url = `/api/weshop/face/storeSkinface/page`; + const { data: res } = await request.promiseGet(url, { + isShowLoading: true, + data: { + store_id: setting.stoid, + user_id: os.user_id, + page: 1, + pageSize:1, + } + }); + // initChart.setOption(option); + if (res.code == 0 && res.data.pageData.length > 0) { + this.setData({show_his:1}) + } } + + }) \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/index/aiskin.wxml b/packageD/pages/AI-test-skin/index/aiskin.wxml index cf73e9b..0bb66b7 100644 --- a/packageD/pages/AI-test-skin/index/aiskin.wxml +++ b/packageD/pages/AI-test-skin/index/aiskin.wxml @@ -1,10 +1,12 @@ - - 历史档案 - + + 历史档案 + - - - 开始测肤 + + + + 开始测肤 + \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/index/aiskin.wxss b/packageD/pages/AI-test-skin/index/aiskin.wxss index cd27949..04e15c2 100644 --- a/packageD/pages/AI-test-skin/index/aiskin.wxss +++ b/packageD/pages/AI-test-skin/index/aiskin.wxss @@ -1,16 +1,7 @@ -/* packageB/pages/AI-test-skin/aiskin.wxss */ -page { - width: 100%; - height: 100%; -} -image { - width: 100vw; - height: 100%; -} + .container1 { position: relative; width: 100%; - height: 100%; } .history { margin-top: 30rpx; @@ -21,18 +12,19 @@ image { border-radius: 50rpx 0 0 50rpx; box-shadow: 0 0 2px 2px #f7f5f5; color: #4ad5df; + align-items: center; + z-index: 100; } .start_btn { - position: fixed; - bottom: 50rpx; - /* margin: auto; */ - /* text-align: center; */ margin-left: 50%; transform: translateX(-50%); background: #4bd6df; - padding: 20rpx; + padding:16rpx 20rpx; width: 67%; text-align: center; border-radius: 40rpx; color: #fff; + font-size: 30rpx; + position:absolute; + bottom: 90rpx; } \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/select_photo/select_photo.js b/packageD/pages/AI-test-skin/select_photo/select_photo.js index cd1872c..bc32fd8 100644 --- a/packageD/pages/AI-test-skin/select_photo/select_photo.js +++ b/packageD/pages/AI-test-skin/select_photo/select_photo.js @@ -1,11 +1,3 @@ -/* - * @Author: your name - * @Date: 2022-02-16 14:34:42 - * @LastEditTime: 2022-02-16 15:42:25 - * @LastEditors: Please set LastEditors - * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\select_photo\select_photo.js - */ // packageB/pages/AI-test-skin/select_photo/select_photo.js const app = getApp(); const request = app.request; @@ -20,84 +12,191 @@ Page({ data: { iurl: setting.imghost, gl_skin_img: null, + skin_type: 0, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - var img=getApp().globalData.skin_img; - this.setData({gl_skin_img:img}) - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () {}, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - + var img = getApp().globalData.skin_img_info; + this.setData({ gl_skin_img: img }) }, //-- 完成选择 -- - ok_select:function () { - var th=this; - app.request.uploadFile("/api/weshop/baidubce/face/uploadImg?uploadPath=faceimg&storeId="+setting.stoid, { - filePath: th.data.gl_skin_img, - name: "file", - success: function (e) { - if(e.data.code==0) { - getApp().globalData.face_img=e.data.data.img; - getApp().globalData.face_SourceImg=e.data.data.SourceImg; - - let url = "/packageB/pages/AI-test-skin/analyse/analyse"; //跳到分析页 - app.goto(url); + ok_select: function () { + const th = this; + this.check_num(function () { + let filePath = th.data.gl_skin_img['path']; + app.request.uploadFile("/api/weshop/baidubce/face/uploadImg?uploadPath=faceimg&storeId=" + setting.stoid, { + filePath: th.data.gl_skin_img['path'], + name: "file", + success: function (e) { + if (e.data.code == 0) { + getApp().globalData.face_img = e.data.data.img; + getApp().globalData.face_SourceImg = e.data.data.SourceImg; + let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页 + app.goto(url); + } else { + wx.showToast({ + title: e.data.msg, + icon: 'none', + duration: 2000 + }); + }; + } + }); + }) - } else { - wx.showToast({ - title: e.data.msg, - icon: 'none', - duration: 2000 - }); - }; - } - }); }, - //-- 重新从相册中选择图片 -- - show_pai_pop:function () { - var th=this; + show_pai_pop: function () { + var th = this; //选择和拍照一张图片 wx.chooseImage({ count: 1, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], - success (res) { + success(res) { let imgArr = res.tempFilePaths; - getApp().globalData.skin_img=imgArr[0]; - th.setData({gl_skin_img:imgArr[0]}) + if (th.data.skin_type) { + imgArr = res.tempFiles; + } + getApp().globalData.skin_img_info = imgArr[0]; + th.setData({ gl_skin_img: imgArr[0] }) } }) - + }, + //选择图片 + takePhoto() { + var that = this; + wx.chooseImage({ + count: 1, + sizeType: ['compressed'], + sourceType: ['album', 'camera'], + success(res) { + var tempFilePaths = res.tempFilePaths + console.log(tempFilePaths); + console.log(res.tempFiles[0].size / 1024 + 'kb'); + var size1 = res.tempFiles[0].size; + var size = res.tempFiles[0].size / 1024; //kb单位 + // tempFilePath可以作为img标签的src属性显示图片 + var img = tempFilePaths[0]; + that.setData({ + imagesrc: img, + }) + that.imgToMin(img, size, size1); //获取图片后压缩 + + }, + fail(err) { + console.log(err); + } + }) + }, + //缩放图片 + imgToMin(img, size, size1) { + var that = this; + //size小于100kb 时 直接转码识别 + if (size < 1024) { + getApp().globalData.skin_img_info = { + path:img, + size, + } + let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; + app.goto(url); + // that.base64(img,"jpg"); + return; + } + + //先获取图片 然后根据长宽 缩小 之后获取图片 + wx.getImageInfo({ + src: img, + success(res) { + var ratio = Math.trunc(size / 1024); + size1 = size1 / ratio; + var canvasWidth = res.width //图片原始长宽 + var canvasHeight = res.height + //while (canvasWidth > 375 || canvasHeight > 520){// 保证宽高在400以内 + canvasWidth = Math.trunc(canvasWidth / ratio) + canvasHeight = Math.trunc(canvasHeight / ratio) + //ratio++; + //} + that.setData({ canvasWidth: canvasWidth, canvasHeight: canvasHeight }) + console.log(canvasWidth) + console.log(canvasHeight) + //绘制图片 + var ctx = wx.createCanvasContext('attendCanvasId') + ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight) + ctx.draw(false, setTimeout(function () { + wx.canvasToTempFilePath({ + canvasId: 'attendCanvasId', + width: canvasWidth, + height: canvasHeight, + destWidth: canvasWidth, + destHeight: canvasHeight, + fileType: 'jpg', + success: function (res) { + console.log(res.tempFilePath)//最终图片路径 + that.setData({ + canvasImgUrl: res.tempFilePath + }); + getApp().globalData.skin_img_info = { + path: res.tempFilePath, + size: size1 + }; + let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; + app.goto(url); + }, + fail: function (res) { + console.log("缩放图片失败"); + console.log(res.errMsg) + wx.hideLoading(); + wx.showToast({ + title: '识别图片失败', + image: '../../utils/img/wrong.png', + duration: 2000 + }) + that.setData({ + title: "识别失败", + }) + } + }, this) //要填写this对象,表示canvas这个对象 + }, 1000)) //留一定的时间绘制canvas 否则会报错fail canvas is empty + }, + fail: function (res) { + console.log("获取图片失败"); + console.log(res.errMsg) + wx.hideLoading(); + wx.showToast({ + title: '识别图片失败', + image: '../../utils/img/wrong.png', + duration: 2000 + }) + that.setData({ + title: "识别失败", + }) + }, + }) }, - - - + check_num:function (func) { + //判断右没有开AI测肤 + getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{ + if(rs.data.code!=0 || !rs.data.data){ + wx.showToast({ + title: "未开通测肤功能,请联系商家", + icon: 'none', + duration: 3000 + }) + }else if(!rs.data.data.skin_num || rs.data.data.skin_num<=0){ + wx.showToast({ + title: "测肤功能的使用次数已经达到上限,请联系商家", + icon: 'none', + duration: 3000 + }) + }else{ + func(); + } + }) + } }) \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/select_photo/select_photo.wxml b/packageD/pages/AI-test-skin/select_photo/select_photo.wxml index b9fd5d9..3c33116 100644 --- a/packageD/pages/AI-test-skin/select_photo/select_photo.wxml +++ b/packageD/pages/AI-test-skin/select_photo/select_photo.wxml @@ -1,9 +1,10 @@ - - + + + - + 重拍 diff --git a/packageD/pages/AI-test-skin/select_photo/select_photo.wxss b/packageD/pages/AI-test-skin/select_photo/select_photo.wxss index cc1af5f..3bb701c 100644 --- a/packageD/pages/AI-test-skin/select_photo/select_photo.wxss +++ b/packageD/pages/AI-test-skin/select_photo/select_photo.wxss @@ -23,9 +23,8 @@ page { .foot_btn .ok_btn { background: #5dd9dc; - padding: 0 50rpx; + padding: 16rpx 40rpx; border-radius: 50rpx; /* margin: 0 auto; */ - line-height: 100rpx; color: #fff; } diff --git a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js index ca7c7eb..6004d73 100644 --- a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js +++ b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js @@ -1,7 +1,7 @@ /* * @Author: abson * @Date: 2022-02-15 10:01:57 - * @LastEditTime: 2022-02-17 09:40:38 + * @LastEditTime: 2022-03-02 11:44:11 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AEet urkl * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\shoot_notice\shoot_notice.js @@ -19,6 +19,10 @@ Page({ */ data: { iurl: setting.imghost, + notice_show: "", + skin_type: 0, + cWidth: 0, + cHeight: 0, }, /** @@ -32,7 +36,12 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + let th = this; + setTimeout(() => { + th.setData({ + notice_show: 'none', + }) + }, 3000) }, /** @@ -64,23 +73,156 @@ Page({ }, //从相册中选择图片 - show_pai_pop:function () { + show_pai_pop: function () { + let th = this; //选择和拍照一张图片 wx.chooseImage({ count: 1, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], - success (res) { + success(res) { let imgArr = res.tempFilePaths; - getApp().globalData.skin_img=imgArr[0]; - let url = "/packageB/pages/AI-test-skin/select_photo/select_photo"; + // + if (th.data.skin_type) { + imgArr = res.tempFiles; + } + console.log(imgArr); + getApp().globalData.skin_img_info = imgArr[0]; + let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; app.goto(url); } }) }, + //选择图片 + takePhoto() { + var that = this; - - + wx.chooseImage({ + count: 1, + sizeType: ['compressed'], + sourceType: ['album', 'camera'], + success(res) { + var tempFilePaths = res.tempFilePaths + console.log(tempFilePaths); + console.log(res.tempFiles[0].size / 1024 + 'kb'); + var size1 =res.tempFiles[0].size; + var size = res.tempFiles[0].size / 1024; //kb单位 + // tempFilePath可以作为img标签的src属性显示图片 + var img = tempFilePaths[0]; + that.setData({ + imagesrc: img, + }) + that.imgToMin(img, size,size1); //获取图片后压缩 + + }, + fail(err) { + console.log(err); + } + }) + }, + //图片转码64 + base64(url, type) { + var that = this; + return new Promise((resolve, reject) => { + wx.getFileSystemManager().readFile({ + filePath: url, //选择图片返回的相对路径 + encoding: 'base64', //编码格式 + success: res => { + resolve('data:image/' + type.toLocaleLowerCase() + ';base64,' + res.data) + // console.log(res.data); + // that.doDiscernment(res.data);//提交后台 + }, + fail: res => reject(res.errMsg) + }) + }) + }, + //缩放图片 + imgToMin(img, size,size1) { + var that = this; + //size小于100kb 时 直接转码识别 + if (size < 1024) { + getApp().globalData.skin_img_info = { + path:img, + size, + } + let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; + app.goto(url); + // that.base64(img,"jpg"); + return; + } + + //先获取图片 然后根据长宽 缩小 之后获取图片 + wx.getImageInfo({ + src: img, + success(res) { + console.log(res.width) + console.log(res.height) + var ratio = size / 1024; + size1 = size1 / ratio; + var canvasWidth = res.width //图片原始长宽 + var canvasHeight = res.height + //while (canvasWidth > 375 || canvasHeight > 520){// 保证宽高在400以内 + canvasWidth = Math.trunc(canvasWidth / ratio) + canvasHeight = Math.trunc(canvasHeight / ratio) + //ratio++; + //} + that.setData({ canvasWidth: canvasWidth, canvasHeight: canvasHeight }) + console.log(canvasWidth) + console.log(canvasHeight) + //绘制图片 + var ctx = wx.createCanvasContext('attendCanvasId') + ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight) + ctx.draw(false, setTimeout(function () { + wx.canvasToTempFilePath({ + canvasId: 'attendCanvasId', + width: canvasWidth, + height: canvasHeight, + destWidth: canvasWidth, + destHeight: canvasHeight, + fileType: 'jpg', + success: function (res) { + console.log(res.tempFilePath)//最终图片路径 + that.setData({ + canvasImgUrl: res.tempFilePath + }); + getApp().globalData.skin_img_info = { + path:res.tempFilePath, + size:size1 + }; + let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; + app.goto(url); + }, + fail: function (res) { + console.log("缩放图片失败"); + console.log(res.errMsg) + wx.hideLoading(); + wx.showToast({ + title: '识别图片失败', + image: '../../utils/img/wrong.png', + duration: 2000 + }) + that.setData({ + title: "识别失败", + }) + } + }, this) //要填写this对象,表示canvas这个对象 + }, 1000)) //留一定的时间绘制canvas 否则会报错fail canvas is empty + }, + fail: function (res) { + console.log("获取图片失败"); + console.log(res.errMsg) + wx.hideLoading(); + wx.showToast({ + title: '识别图片失败', + image: '../../utils/img/wrong.png', + duration: 2000 + }) + that.setData({ + title: "识别失败", + }) + }, + }) + }, }) \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml index 99642af..bf3b8e6 100644 --- a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml +++ b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml @@ -1,5 +1,6 @@ + 根据要求拍摄,测肤结果更准确。 准备工作 @@ -49,9 +50,12 @@ + + + - 准备闭眼拍摄 + 准备闭眼拍摄 如无闭眼,将导致图片分析失败 diff --git a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss index f098f26..3b40331 100644 --- a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss +++ b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss @@ -6,7 +6,31 @@ page { box-sizing: border-box; background-color: #e7f5fb; } + +@keyframes notice_show { + 0% { + top: -999rpx; + } + + 100% { + top: 10rpx; + } +} + +.notice_show { + text-align: center; + padding: 30rpx; + color: skyblue; + position: absolute; + right: 10%; + box-shadow: #f0f0f0 0px 0px 5px; + z-index: 999; + background: #fff; + animation: 2s notice_show linear; +} + .content { + position: relative; width: 100%; /* height: 100%; */ border-radius: 25rpx; @@ -26,11 +50,12 @@ page { align-items: center; margin-bottom: 40rpx } + .content .ready1 { display: flex; flex-direction: column; align-items: center; - padding-bottom: 50rpx ; + padding-bottom: 50rpx; /* margin-bottom: 40rpx */ } @@ -65,19 +90,21 @@ page { .content image { height: 100%; } + .btn { - + /* height: 150rpx; */ /* margin-left: 50%; */ margin: 70rpx 0 30rpx 50%; transform: translateX(-50%); background: #4bd6df; - padding: 20rpx; + padding: 15rpx 15rpx; width: 50%; text-align: center; - border-radius: 40rpx; + border-radius: 50rpx; color: #fff; } + .btn_fixed { position: fixed; width: 100%; @@ -85,6 +112,7 @@ page { height: 300rpx; background: #e7f5fb; } + .notice { text-align: center; color: red; @@ -98,36 +126,71 @@ page { right: 0; bottom: 0; z-index: 11; - background: rgba(0,0,0,0.4); + background: rgba(0, 0, 0, 0.4); width: 100%; height: 100%; } -.flex{display: flex} -.jc-center{ +.flex { + display: flex +} + +.jc-center { justify-content: center; } -.ac{align-items: center} -.pai_content{ - position: fixed;z-index: 100;bottom: 0;background: #FFFFFF;width: 100%; - border-top-left-radius:30rpx; - border-top-right-radius:30rpx; + +.ac { + align-items: center } -.p_item{ height: 100rpx; line-height: 100rpx;text-align: center; border-bottom: 1rpx solid #eee} -.p_cancle{height: 100rpx; line-height: 100rpx;text-align: center; border-top:20rpx solid #f8f8f8;} -@keyframes p_up -{ - from {transform:translateY(100%);} - to {transform:translateY(0);} +.pai_content { + position: fixed; + z-index: 100; + bottom: 0; + background: #FFFFFF; + width: 100%; + border-top-left-radius: 30rpx; + border-top-right-radius: 30rpx; +} + +.p_item { + height: 100rpx; + line-height: 100rpx; + text-align: center; + border-bottom: 1rpx solid #eee +} + +.p_cancle { + height: 100rpx; + line-height: 100rpx; + text-align: center; + border-top: 20rpx solid #f8f8f8; } -@keyframes p_down -{ - from {transform:translateY(0);} - to {transform:translateY(100%);} +@keyframes p_up { + from { + transform: translateY(100%); + } + + to { + transform: translateY(0); + } } -.p_to_up{animation:p_up 1s;} -.p_to_down{animation:p_down 0.5s;} +@keyframes p_down { + from { + transform: translateY(0); + } + + to { + transform: translateY(100%); + } +} + +.p_to_up { + animation: p_up 1s; +} +.p_to_down { + animation: p_down 0.5s; +} \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/success_result/acne/acne.wxml b/packageD/pages/AI-test-skin/success_result/acne/acne.wxml index 9fa7938..d9f1a84 100644 --- a/packageD/pages/AI-test-skin/success_result/acne/acne.wxml +++ b/packageD/pages/AI-test-skin/success_result/acne/acne.wxml @@ -4,7 +4,11 @@ #0{{acne_sort}} - 痤疮 + + + 痤疮 + + 问题标注 diff --git a/packageD/pages/AI-test-skin/success_result/dark/dark.wxml b/packageD/pages/AI-test-skin/success_result/dark/dark.wxml index 3e92d71..c068c85 100644 --- a/packageD/pages/AI-test-skin/success_result/dark/dark.wxml +++ b/packageD/pages/AI-test-skin/success_result/dark/dark.wxml @@ -4,7 +4,11 @@ #0{{dark_sort}} - 黑眼圈 + + + 黑眼圈 + + 问题标注 @@ -39,15 +43,15 @@ - 色素性-中度 + 色素性 - 血管性-轻度 + 血管性 - 阴影型-无 + 阴影型 diff --git a/packageD/pages/AI-test-skin/success_result/pore/pore.wxml b/packageD/pages/AI-test-skin/success_result/pore/pore.wxml index f5ead0d..6f23a75 100644 --- a/packageD/pages/AI-test-skin/success_result/pore/pore.wxml +++ b/packageD/pages/AI-test-skin/success_result/pore/pore.wxml @@ -4,7 +4,10 @@ #0{{port_sort}} - 毛孔 + + 毛孔 + + 问题标注 diff --git a/packageD/pages/AI-test-skin/success_result/sensitive/sensitive.js b/packageD/pages/AI-test-skin/success_result/sensitive/sensitive.js index 0aa0c90..5c00212 100644 --- a/packageD/pages/AI-test-skin/success_result/sensitive/sensitive.js +++ b/packageD/pages/AI-test-skin/success_result/sensitive/sensitive.js @@ -2,7 +2,6 @@ module.exports = { //把组合购的商品价格计算出来,同时每个会员都有购买组合商品的上限!ladder_b_num是已经购买了多少件 get_goods: function (th, stoid,sort) { th.setData({sensitive_sort:sort}); - var r_code = '12'; //获取毛孔的类型 var arr = th.data.face_data.skinquality.skin_sensitive_check; diff --git a/packageD/pages/AI-test-skin/success_result/success_result.js b/packageD/pages/AI-test-skin/success_result/success_result.js index 50720bc..e606b81 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.js +++ b/packageD/pages/AI-test-skin/success_result/success_result.js @@ -1,7 +1,7 @@ /* * @Author: abson * @Date: 2022-02-16 15:36:47 - * @LastEditTime: 2022-02-24 14:16:37 + * @LastEditTime: 2022-02-28 16:01:07 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\success_result\success_result.js @@ -19,18 +19,23 @@ const dark = require('dark/dark'); const pore = require('pore/pore'); const speckle = require('speckle/speckle'); const wrinkle = require('wrinkle/wrinkle'); +const sensitive = require('sensitive/sensitive') Page({ /** * 页面的初始数据 */ data: { - tab: [{ id: 'zong_he', name: '综合肤质' }, { id: 'mao_kong', name: '毛孔' }, { id: 'hei_tou', name: '黑头' }, { id: 'se_ban', name: '色斑' }, { id: 'zhou_wen', name: '皱纹' }, { id: 'hei_yan_quan', name: '黑眼圈' }, { id: 'cuo_chuang', name: '痤疮' }, { id: 'min_gan_du', name: '敏感度' }], + // tab: [{ id: 'zong_he', name: '综合肤质' }, { id: 'mao_kong', name: '毛孔' }, { id: 'hei_tou', name: '黑头' }, { id: 'se_ban', name: '色斑' }, { id: 'zhou_wen', name: '皱纹' }, { id: 'hei_yan_quan', name: '黑眼圈' }, { id: 'cuo_chuang', name: '痤疮' }, { id: 'min_gan_du', name: '敏感度' }], zhouwen_arr: [{ id: 1, name: '全部皱纹' }, { id: 2, name: '抬头纹' }, { id: 3, name: '川字纹' }, { id: 4, name: '眼周细纹' }, { id: 5, name: '鱼尾纹' }, { id: 6, name: '法令纹' }, { id: 7, name: '口周纹' }], - cuochuang_arr: [{ id: 1, name: '全部痤疮' }, { id: 2, name: '粉刺 ' }, { id: 3, name: '痘印 ' }, { id: 4, name: '脓包' }, { id: 5, name: '结节'}], + cuochuang_arr: [{ id: 1, name: '全部痤疮' }, { id: 2, name: '粉刺 ' }, { id: 3, name: '痘印 ' }, { id: 4, name: '脓包' }, { id: 5, name: '结节' }], + zhouwen_arr1: [{ id: 1, name: '皱纹/细纹', des: '是指皮肤受到外界环境影响,形成游离自由基,自由基破坏正常细胞膜组织内的胶原蛋白、活性物质,氧化细胞,或缺水而形成的小细纹,继而严重形成皱纹', sign: 'zhou1', sign1: 'zhou2' }, { id: 2, name: '抬头皱纹/抬头细纹', des: '位于额头的皱纹、细纹。形成原因因人而异,后天因素是比较少的。-般多为横纹, 竖纹较少见。', sign: 'zhou3', sign1: 'zhou4' }, { id: 3, name: '眼部皱纹/眼部细纹', des: '眼部皱纹、细纹一般位于下眼睑部位,多见于下脸内1/3处。', sign: 'zhou5', sign1: 'zhou6' }, { id: 4, name: '鱼尾纹', des: '眼部皱纹的一种,是在人两侧外眼角和登角之间出现的皱纹,其纹路与鱼尾巴上的纹路很相似,故被形象地称为鱼尾纹。', sign: 'zhou7', sign1: 'zhou8' }, { id: 5, name: '眉间纹', des: '又叫川字纹,皱眉纹,是面部的一种正常的表情纹,随着年龄的增长,面部的皱纹会逐渐加深,双眉之间逐渐形成了较深的皱折,会使人看起来总是愁眉不展。', sign: 'zhou9', sign1: 'zhou10' }, { id: 6, name: '泪沟', des: '泪沟是指由内眼角开始出现在下眼睑靠鼻侧的两条凹沟,是由于眼眶隔膜下缘的软组织萎缩、下垂而生成的。', sign: 'zhou11', sign1: 'zhou12' }, { id: 7, name: '法令纹', des: '法令纹是位于鼻翼边延伸而下的两道纹路,是典型的皮肤组织老化、造成肌肤表面凹陷的现象。', sign: 'zhou15', sign1: 'zhou16' }, { id: 8, name: '口角纹', des: '口角纹又称木偶纹、括号纹,位于嘴角延伸而下的两道纹路,是表情肌、重力和遗传基因等几方面因素综合形成的。', sign: 'zhou13', sign1: 'zhou14' }], + cuochuang_arr1: [{ id: 1, name: '痘印,痘坑', des: '痤疮消退后留下的痕迹,- 般包括黑色痘印,红色痘印,凹洞性痘坑,增生性凸疤。', sign: 'cuo1', sign1: 'cuo2' }, { id: 2, name: '粉刺', des: '粉刺也称为白头,是毛囊漏斗部被角质层细胞堆积、堵塞,角化物质和皮脂充塞其中,形成白色丘疹,表面有表皮覆盖,与外界不相通,成为封闭式粉刺。(痤疮I级)', sign: 'cuo3', sign1: 'cuo4' }, { id: 3, name: '丘疹', des: '丘疹性痤疮是由皮损导致炎性弓|起的小米至豌豆大的坚硬的小丘疹,呈淡红色至深红色。丘疹中央可有一个黑头粉刺或顶端未变黑的皮脂栓。(痤疮II级)', sign: 'cuo5', sign1: 'cuo6' }, { id: 4, name: '结节囊肿', des: '表现为蚕豆至指甲大的炎性结节或囊肿,为重度痤疮,严重者可继发化脓感染、破溃流出血脓,后形成窦道及瘢痕。触摸有波动感。若面部相邻长着多个囊肿,可能通过皮下的“窦道"“暗通,可能需要手术解决。(痤疮IV级)', sign: 'cuo7', sign1: 'cuo8' }], heitanquan_arr: [{ id: 1, name: '综合情况' }, { id: 2, name: '左眼' }, { id: 3, name: '右眼' }], + heitanquan_arr1: [{ id: 1, name: '色素性黑眼圈', des: '呈茶褐色,是因眼裂向外眼角的延伸段有色素沉着或因先天或外来刺激导致眼周肤色黯沉。', sign: 'hei1', sign1: 'hei2' }, { id: 2, name: '血管性黑眼圈', des: '呈青紫色,由于眼周血液循环不良,下眼脸处皮肤与皮下脂肪变薄,皮下血管透出颜色形成的。', sign: 'hei3', sign1: 'hei4' }, { id: 3, name: '阴影型黑眼圈', des: '表现为眼袋膨出、泪沟凹陷。由于年龄的增长,眼周皮肤肌肉都会变得松弛,脂肪量变化而引起。', sign: 'hei5', sign1: 'hei6' }], currentIndex: 0, scroll_index: 0, - sex:'female', //female女 male男 + yiwen_index: 0, + sex: 'female', //female女 male男 tab_id: 'zong_he', iurl: setting.imghost, showDialog: false, @@ -40,21 +45,32 @@ Page({ img_scale_icon: true, show_problem: 1, //问题标注显示问题 img_scale: 1, //缩放问题 - sex:'', - is_esys_show:0, //是不是显示眼睛 - scroll_id:1, //初始为1 - - wrinkle_num1:0, //抬头纹 - wrinkle_num2:0, //川字纹 - wrinkle_num3:0, //眼周细纹 - wrinkle_num4:0, //鱼尾纹 - wrinkle_num5:0, //法令纹 - wrinkle_num6:0, //口周纹 + sex: '', + is_esys_show: 0, //是不是显示眼睛 + scroll_id: 1, //初始为1 + + wrinkle_num1: 0, //抬头纹 + wrinkle_num2: 0, //川字纹 + wrinkle_num3: 0, //眼周细纹 + wrinkle_num4: 0, //鱼尾纹 + wrinkle_num5: 0, //法令纹 + wrinkle_num6: 0, //口周纹 + yiwen_type: 0, //1皱纹 2黑眼圈 3痤疮 + acne_num1: 0, //粉刺 + acne_num2: 0, //痘印 + acne_num3: 0, //脓包 + acne_num4: 0, //结节 + }, - acne_num1:0, //粉刺 - acne_num2:0, //痘印 - acne_num3:0, //脓包 - acne_num4:0, //结节 + onReady: function () { + //用异步的获取比较准一点 + wx.getSystemInfo({ + success(res) { + console.log(111); + console.log(res.windowWidth); + console.log(res.windowHeight); + } + }) }, /** @@ -69,211 +85,243 @@ Page({ //var face_data=face_result.face_list[0]; this.data.id = options.id; - //计算图片要显示的大小 - th.data.cWidth = wx.getSystemInfoSync().windowWidth; - th.data.cHeight = wx.getSystemInfoSync().windowHeight; - th.data.face_height = th.data.cHeight * 0.8 * 0.75; - - var bi1= (th.data.cHeight * 0.8 * 0.8)/(th.data.cWidth*0.8); - this.get_data(function (json, json1, img) { - //-- 数据先存着 -- - var face_data = th.data.face_data = json.face_list[0]; - var face_data1 = th.data.face_data1 = json1.face_list[0]; - var sex = face_data1.gender.type; - //痤疮数 - var acne_num = face_data.acnespotmole.acne_num; - //色斑数 - var speckle_num = face_data.acnespotmole.speckle_num; - //皱纹数 - var wrinkle_num = face_data.wrinkle.wrinkle_num; - //黑头数 - var blackhead_num = face_data.blackheadpore.blackhead_num; - //毛孔数 - var pore_num = face_data.blackheadpore.pore_num; - //黑眼圈的严重程度 - var dark_type = face_data.eyesattr.dark_circle_left_type.length > 0 ? face_data.eyesattr.dark_circle_left_type[0] : -1; - var dark_type1 = face_data.eyesattr.dark_circle_right_type.length > 0 ? face_data.eyesattr.dark_circle_right_type[0] : -1; - - var dk_type1=dark_type; - var dk_type2=dark_type1; - if (dark_type1 > dark_type) { - dark_type = dark_type1; - } - var skin_sensitive_check = parseInt(face_data.skinquality.skin_sensitive_check[0]); - var skin_dryoil_check = face_data.skinquality.skin_dryoil_check; - - var location = face_data.location; - var bili = th.data.face_height / (location.height + location.height / 2.3); - - //获取眼睛的画图比例 - var eye_data1=face_data1.landmark150.eye_left_corner_right; - var eye_data2=face_data1.landmark150.eye_left_corner_left; - var eye_data3=face_data1.landmark150.eye_right_corner_left; - - var hei1=Math.abs(eye_data1.x-eye_data2.x); - var bili_eye = th.data.face_height /(2*hei1*bi1); - var eye_top=eye_data1.y-hei1*3/4 - var eye_left1=eye_data1.x-hei1/2; - var eye_left2=eye_data3.x-hei1-hei1/2; - - var skin_dryoil_check_type=0;//干性 - var skin_dryoil_check_arr=[] - for(let i in skin_dryoil_check){ - let item=skin_dryoil_check[i]; - if(item!='1' && skin_dryoil_check_arr.indexOf(item)==-1){ - skin_dryoil_check_arr.push(item); - } - } - //皮肤干油性的判断 - if(skin_dryoil_check_arr.length==0) skin_dryoil_check_type=1; - else if(skin_dryoil_check_arr.length==1) skin_dryoil_check_type=parseInt(skin_dryoil_check_arr[0]); - else skin_dryoil_check_type=3; - - var wrinkle_types=face_data.wrinkle.wrinkle_types; - var w_arr=wrinkle_types.filter(function (e) { - return e==1; - }) - th.data.wrinkle_num1=w_arr.length; + //用异步的获取比较准一点 + wx.getSystemInfo({ + success(res) { + //计算图片要显示的大小 + th.data.cWidth = res.windowWidth; + th.data.cHeight = res.windowHeight; + + console.log(222); + console.log(res.windowWidth); + console.log(res.windowHeight); + + + th.data.face_height = th.data.cHeight * 0.8 * 0.75; + + var bi1 = (th.data.cHeight * 0.8 * 0.8) / (th.data.cWidth * 0.8); + th.get_data(function (json, json1, img) { + //-- 数据先存着 -- + var face_data = th.data.face_data = json.face_list[0]; + var face_data1 = th.data.face_data1 = json1.face_list[0]; + var sex = face_data1.gender.type; + //痤疮数 + var acne_num = face_data.acnespotmole.acne_num; + //色斑数 + var speckle_num = face_data.acnespotmole.speckle_num; + //皱纹数 + var wrinkle_num = face_data.wrinkle.wrinkle_num; + //黑头数 + var blackhead_num = face_data.blackheadpore.blackhead_num; + //毛孔数 + var pore_num = face_data.blackheadpore.pore_num; + //黑眼圈的严重程度 + var dark_type = face_data.eyesattr.dark_circle_left_type.length > 0 ? face_data.eyesattr.dark_circle_left_type[0] : -1; + var dark_type1 = face_data.eyesattr.dark_circle_right_type.length > 0 ? face_data.eyesattr.dark_circle_right_type[0] : -1; + + var dk_type1 = dark_type; + var dk_type2 = dark_type1; + if (dark_type1 > dark_type) { + dark_type = dark_type1; + } + var skin_sensitive_check = parseInt(face_data.skinquality.skin_sensitive_check[0]); + var skin_dryoil_check = face_data.skinquality.skin_dryoil_check; + + var location = face_data.location; + var bili = th.data.face_height * 0.76 / location.height; + + //获取眼睛的画图比例 + var eye_data1 = face_data1.landmark150.eye_left_corner_right; + var eye_data2 = face_data1.landmark150.eye_left_corner_left; + var eye_data3 = face_data1.landmark150.eye_right_corner_right; + + var hei1 = Math.abs(eye_data1.x - eye_data2.x); + var bili_eye = th.data.face_height * 0.56 / hei1; + var eye_top = eye_data1.y - hei1 / 2 + var eye_left1 = eye_data1.x - hei1 / 6; + var eye_left2 = eye_data3.x - hei1 / 6; + + var skin_dryoil_check_type = 0;//干性 + var skin_dryoil_check_arr = [] + for (let i in skin_dryoil_check) { + let item = skin_dryoil_check[i]; + if (item != '1' && skin_dryoil_check_arr.indexOf(item) == -1) { + skin_dryoil_check_arr.push(item); + } + } + //皮肤干油性的判断 + if (skin_dryoil_check_arr.length == 0) skin_dryoil_check_type = 1; + else if (skin_dryoil_check_arr.length == 1) skin_dryoil_check_type = parseInt(skin_dryoil_check_arr[0]); + else skin_dryoil_check_type = 3; + + var wrinkle_types = face_data.wrinkle.wrinkle_types; + var w_arr = wrinkle_types.filter(function (e) { + return e == 1; + }) + th.data.wrinkle_num1 = w_arr.length; - //皱纹的数量的统计 - w_arr=wrinkle_types.filter(function (e) { - return e==2; - }) - th.data.wrinkle_num2=w_arr.length; - w_arr=wrinkle_types.filter(function (e) { - return e==3; - }) - th.data.wrinkle_num3=w_arr.length; - w_arr=wrinkle_types.filter(function (e) { - return e==4; - }) - th.data.wrinkle_num4=w_arr.length; - w_arr=wrinkle_types.filter(function (e) { - return e==5; - }) - th.data.wrinkle_num5=w_arr.length; - w_arr=wrinkle_types.filter(function (e) { - return e==6; - }) - th.data.wrinkle_num6=w_arr.length; + //皱纹的数量的统计 + w_arr = wrinkle_types.filter(function (e) { + return e == 2; + }) + th.data.wrinkle_num2 = w_arr.length; + w_arr = wrinkle_types.filter(function (e) { + return e == 3; + }) + th.data.wrinkle_num3 = w_arr.length; + w_arr = wrinkle_types.filter(function (e) { + return e == 4; + }) + th.data.wrinkle_num4 = w_arr.length; + w_arr = wrinkle_types.filter(function (e) { + return e == 5; + }) + th.data.wrinkle_num5 = w_arr.length; + w_arr = wrinkle_types.filter(function (e) { + return e == 6; + }) + th.data.wrinkle_num6 = w_arr.length; - //痘痘的不同的统计 - var acne_list = face_data.acnespotmole.acne_list; - var a_arr=acne_list.filter(function (e) { - return e.type==0; - }) - th.data.acne_num1=a_arr.length; - a_arr=acne_list.filter(function (e) { - return e.type==1; - }) - th.data.acne_num2=a_arr.length; - a_arr=acne_list.filter(function (e) { - return e.type==2; - }) - th.data.acne_num3=a_arr.length; - a_arr=acne_list.filter(function (e) { - return e.type==3; - }) - th.data.acne_num4=a_arr.length; - - th.setData({ - acne_num: acne_num, - speckle_num: speckle_num, - wrinkle_num: wrinkle_num, - wrinkle_types:wrinkle_types, //皱纹类型 - blackhead_num: blackhead_num, - pore_num: pore_num, - dark_type: dark_type, - dark_typ1: dk_type1, - dark_type2: dk_type2, - skin_sensitive_check: skin_sensitive_check, - skin_dryoil_check: skin_dryoil_check, - skin_dryoil_check_type:skin_dryoil_check_type, - face_img: img, - m_top: (location.top - location.height / 2.5) * bili, - m_left: (location.left - location.width / 7) * bili, - bili: bili, - bili_eye:bili_eye, - sex:sex, - skin_dryoil_check_type:skin_dryoil_check_type, - eye_top:eye_top, - eye_left1:eye_left1* bili_eye, - eye_left2:eye_left2* bili_eye, - - wrinkle_num1:th.data.wrinkle_num1, //抬头纹 - wrinkle_num2:th.data.wrinkle_num2, //川字纹 - wrinkle_num3:th.data.wrinkle_num3, //眼周细纹 - wrinkle_num4:th.data.wrinkle_num4, //鱼尾纹 - wrinkle_num5:th.data.wrinkle_num5, //法令纹 - wrinkle_num6:th.data.wrinkle_num6, //口周纹 - - acne_num1:th.data.acne_num1, //粉刺 - acne_num2:th.data.acne_num2, //痘印 - acne_num3:th.data.acne_num3, //脓包 - acne_num4:th.data.acne_num4, //结节 - }) - var sort = 1; - //-- 调用毛孔的推荐函数 -- - if (pore_num > 0) - pore.get_goods(th, setting.stoid, sort++); - //-- 调用黑头的推荐函数 -- - if (blackhead_num > 0) - blackhead.get_goods(th, setting.stoid, sort++); - //-- 调用色斑的推荐函数 -- - if (speckle_num > 0) - speckle.get_goods(th, setting.stoid, sort++); - //-- 调用皱纹的推荐函数 -- - if (wrinkle_num > 0) - wrinkle.get_goods(th, setting.stoid, sort++); - //-- 黑眼圈 -- - if (dark_type > -1) - dark.get_goods(th, setting.stoid, sort++); - //-- 黑眼圈 -- - if (acne_num > -0) - acne.get_goods(th, setting.stoid, sort++); - - //-- 获取一下分享要用的图片 -- - th.set_share_img(); - acne.get_goods(th, setting.stoid); - let { heightRecord, tab } = th.data; - tab.forEach(item => { - console.log(2); - var query = th.createSelectorQuery(); - let class_name = `.${item['id']}`; - query.select(class_name).boundingClientRect(function (rect) { - // let ratio = 750 / rect.width; - let height = parseInt(rect.height); //加上导航栏50px - heightRecord.push(height); - // item['top'] = top; - }).exec(); - }); - heightRecord.sort((a, b) => { - return a - b; - }); - th.setData({ - heightRecord, - }) - // setTimeout(() => { - // heightRecord.sort((a, b) => { - // return a - b; - // }) - // let new_arr = []; - // if (heightRecord.length > 0) { - // heightRecord.reduce((pre, cur) => { - // let sum = pre + cur; - // new_arr.push(sum); - // return sum; - // }) - // } - // th.setData({ - // heightRecord:new_arr, - // }) - // },1000) + //痘痘的不同的统计 + var acne_list = face_data.acnespotmole.acne_list; + var a_arr = acne_list.filter(function (e) { + return e.type == 0; + }) + th.data.acne_num1 = a_arr.length; + a_arr = acne_list.filter(function (e) { + return e.type == 1; + }) + th.data.acne_num2 = a_arr.length; + a_arr = acne_list.filter(function (e) { + return e.type == 2; + }) + th.data.acne_num3 = a_arr.length; + a_arr = acne_list.filter(function (e) { + return e.type == 3; + }) + th.data.acne_num4 = a_arr.length; + let tab_arr = [{ id: 'zong_he', name: '综合肤质' }]; + if (pore_num) { + tab_arr.push({ id: 'mao_kong', name: '毛孔' }); + } + if (blackhead_num) { + tab_arr.push({ id: 'hei_tou', name: '黑头' }); + } + if (speckle_num) { + tab_arr.push({ id: 'se_ban', name: '色斑' }); + } + if (wrinkle_num) { + tab_arr.push({ id: 'zhou_wen', name: '皱纹' }); + } + if (dark_type > -1) { + tab_arr.push({ id: 'hei_yan_quan', name: '黑眼圈' }); + } + if (acne_num) { + tab_arr.push({ id: 'cuo_chuang', name: '痤疮' }); + } + tab_arr.push({ id: 'min_gan_du', name: '敏感度' }); + th.setData({ + acne_num: acne_num, + speckle_num: speckle_num, + wrinkle_num: wrinkle_num, + wrinkle_types: wrinkle_types, //皱纹类型 + blackhead_num: blackhead_num, + pore_num: pore_num, + dark_type: dark_type, + dark_typ1: dk_type1, + dark_type2: dk_type2, + skin_sensitive_check: skin_sensitive_check, + skin_dryoil_check: skin_dryoil_check, + skin_dryoil_check_type: skin_dryoil_check_type, + face_img: img, + m_top: (location.top - location.height / 3) * bili, + m_left: Math.abs(th.data.cWidth * 0.8 - (location.width + location.left * 2) * bili) / 2, + bili: bili, + bili_eye: bili_eye, + sex: sex, + tab: tab_arr, + skin_dryoil_check_type: skin_dryoil_check_type, + eye_top: eye_top * bili_eye, + eye_left1: eye_left1 * bili_eye, + eye_left2: eye_left2 * bili_eye, + + wrinkle_num1: th.data.wrinkle_num1, //抬头纹 + wrinkle_num2: th.data.wrinkle_num2, //川字纹 + wrinkle_num3: th.data.wrinkle_num3, //眼周细纹 + wrinkle_num4: th.data.wrinkle_num4, //鱼尾纹 + wrinkle_num5: th.data.wrinkle_num5, //法令纹 + wrinkle_num6: th.data.wrinkle_num6, //口周纹 + + acne_num1: th.data.acne_num1, //粉刺 + acne_num2: th.data.acne_num2, //痘印 + acne_num3: th.data.acne_num3, //脓包 + acne_num4: th.data.acne_num4, //结节 + }) + var sort = 1; + //-- 调用毛孔的推荐函数 -- + if (pore_num > 0) + pore.get_goods(th, setting.stoid, sort++); + //-- 调用黑头的推荐函数 -- + if (blackhead_num > 0) + blackhead.get_goods(th, setting.stoid, sort++); + //-- 调用色斑的推荐函数 -- + if (speckle_num > 0) + speckle.get_goods(th, setting.stoid, sort++); + //-- 调用皱纹的推荐函数 -- + if (wrinkle_num > 0) + wrinkle.get_goods(th, setting.stoid, sort++); + //-- 黑眼圈 -- + if (dark_type > -1) + dark.get_goods(th, setting.stoid, sort++); + //-- 黑眼圈 -- + if (acne_num > -0) + acne.get_goods(th, setting.stoid, sort++); + sensitive.get_goods(th, setting.stoid, sort++); + //-- 获取一下分享要用的图片 -- + th.set_share_img(); + acne.get_goods(th, setting.stoid); + // let { heightRecord, tab } = th.data; + // tab.forEach(item => { + // console.log(2); + // var query = th.createSelectorQuery(); + // let class_name = `.${item['id']}`; + // query.select(class_name).boundingClientRect(function (rect) { + // // let ratio = 750 / rect.width; + // let height = parseInt(rect.height); //加上导航栏50px + // heightRecord.push(height); + // // item['top'] = top; + // }).exec(); + // }); + // heightRecord.sort((a, b) => { + // return a - b; + // }); + // th.setData({ + // heightRecord, + // }) + // setTimeout(() => { + // heightRecord.sort((a, b) => { + // return a - b; + // }) + // let new_arr = []; + // if (heightRecord.length > 0) { + // heightRecord.reduce((pre, cur) => { + // let sum = pre + cur; + // new_arr.push(sum); + // return sum; + // }) + // } + // th.setData({ + // heightRecord:new_arr, + // }) + // },1000) - }) + }) + } + }) }, + //-- 初始等级卡 -- init: function () { var th = this; @@ -384,25 +432,25 @@ Page({ }, click_scroll(e) { - let { index, scroll_id} = e.currentTarget.dataset; + let { index, scroll_id } = e.currentTarget.dataset; this.setData({ scroll_index: index, scroll_id, }) //-- 如果是黑眼圈的控制 -- - if(this.data.show_type==5){ - switch (scroll_id){ - case 1: - this.setData({is_esys_show:0}) - break; - case 2: - this.setData({is_esys_show:1}) - break; - default: - this.setData({is_esys_show:2}) - break - } + if (this.data.show_type == 5) { + switch (scroll_id) { + case 1: + this.setData({ is_esys_show: 0 }) + break; + case 2: + this.setData({ is_esys_show: 1 }) + break; + default: + this.setData({ is_esys_show: 2 }) + break + } } }, @@ -427,7 +475,23 @@ Page({ this.setData({ img_scale: !this.data.img_scale, img_scale_icon: !this.data.yanjing, - ig_scale:1,img_top:0,img_left:0 + ig_scale: 1, img_top: 0, img_left: 0 + }) + }, + + click_yiwen_scroll(e) { + let { index, yiwen_id } = e.currentTarget.dataset; + this.setData({ + yiwen_index: index, + yiwen_id, + }) + }, + + close_yiwen() { + this.setData({ + question_dialog: false, + yiwen_index: 0, + yiwen_id: 'yiwen1' }) }, @@ -445,15 +509,17 @@ Page({ }, show_dailog(e) { - var th=this; + var th = this; var type = parseInt(e.currentTarget.dataset.type); this.setData({ - showDialog: true, show_type: type,is_esys_show:0,ig_scale:1,img_top:0,img_left:0,scroll_index:0,scroll_id:1 + showDialog: true, show_type: type, is_esys_show: 0, ig_scale: 1, img_top: 0, img_left: 0, scroll_index: 0, scroll_id: 1 }) switch (type) { case 1: //毛孔 - var pore_list = this.data.face_data.blackheadpore.circles[0].pore; - this.setData({ pore_list: pore_list }); + var pore_list = this.data.face_data.blackheadpore.circles.filter(function (e) { + return e.pore + }) + this.setData({ pore_list: pore_list[0].pore }); break; case 2://色斑 var speckle_list = this.data.face_data.acnespotmole.speckle_list; @@ -461,18 +527,20 @@ Page({ break; case 3://皱纹 var wrinkle_list = this.data.face_data.wrinkle.wrinkle_data; - for(let i in wrinkle_list){ - let item=wrinkle_list[i]; + for (let i in wrinkle_list) { + let item = wrinkle_list[i]; item.map(function (e) { - e.w_type=th.data.wrinkle_types[i]; + e.w_type = th.data.wrinkle_types[i]; return e; }) } this.setData({ wrinkle_list: wrinkle_list }); break; case 4://黑头 - var blackhead_list = this.data.face_data.blackheadpore.circles[0].blackhead; - this.setData({ blackhead_list: blackhead_list }); + var blackhead_list = this.data.face_data.blackheadpore.circles.filter(function (e) { + return e.blackhead + }) + this.setData({ blackhead_list: blackhead_list[0].blackhead }); break; case 5://黑眼圈 var arr = this.data.face_data.eyesattr.dark_circle_left[0]; @@ -589,8 +657,8 @@ Page({ this.setData({ iwidth: imgwidth * th.data.bili, iheight: imgheight * th.data.bili, - eye_w:imgwidth*th.data.bili_eye, - eye_h:imgheight*th.data.bili_eye, + eye_w: imgwidth * th.data.bili_eye, + eye_h: imgheight * th.data.bili_eye, bili1: w / imgwidth //图片放大时候的比例 }) }, @@ -650,7 +718,7 @@ Page({ touchendCallback: function (e) { this.data.tc_end = 1; - }, + }, //--定义的保存图片方法,分享团--- saveImageToPhotosAlbum: function () { @@ -665,7 +733,7 @@ Page({ if (this.data.share_hidden) { this.setData({ share_hidden: false, }); } - ; + wx.showLoading({ title: '生成中...', }) var that = this, th = that; @@ -686,93 +754,92 @@ Page({ wx.getImageInfo({ src: path3, success: function (res) { - var b=1.1; - //获取到二维码的图片 - var vpath = res.path; - var context = wx.createCanvasContext('share'); - // 先画背景 - context.fillStyle = '#ebf6f8'; - // 灰色实心矩形 - // 1. 语法: x坐标, y坐标, 宽度, 高度 - context.fillRect(0,0,750 * rpx,1338 * rpx); - - context.setFontSize(20* rpx) - context.setFillStyle("#00d8e9") - context.fillText("官方检测认证", 28*b* rpx, 80*b* rpx); - - //两个底部颜色 - context.fillStyle = '#a7ecf5'; - context.fillRect(28 *b* rpx,136 *b* rpx,262 *b* rpx,18 *b* rpx); - context.fillRect(28 *b* rpx,194 *b* rpx,262 *b* rpx,18 *b* rpx); - - context.setFontSize(42*b*rpx) - context.setFillStyle("#070609") - context.fillText("我的肌底强韧", 30*b* rpx, 140*b* rpx); - context.fillText("肌肤鲜活润泽", 30*b* rpx, 196*b* rpx); - - //先画一个圆形 - th.circle(context,110*b*rpx, 280*b*rpx,140*b*rpx,"#e7f3f8"); - th.circle(context,130*b*rpx, 300*b*rpx,120*b*rpx,"#c8f2fa"); - //绘制人脸 - context.drawImage(th.data.share_head, 132*b*rpx, 310*b*rpx, 230*b* rpx, 230 *b* rpx); - - //左右俩个框并填充文字 - th.darwRoundRect(38 *b* rpx,340*b*rpx,140*b*rpx,40*b*rpx,20*b*rpx,context); - th.darwRoundRect(324 *b* rpx,340*b*rpx,140*b*rpx,40*b*rpx,20*b*rpx,context); - context.setFontSize(20*b*rpx) - context.setFillStyle("black") - context.fillText("黑眼圈 重度", 50*b* rpx, 368*b* rpx); - context.fillText("毛孔 "+th.data.pore_num, 336*b* rpx, 368*b* rpx); - - //左右俩个框并填充文字 - th.darwRoundRect(40 *b* rpx,412*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); - th.darwRoundRect(348 *b* rpx,412*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); - context.setFillStyle("black") - context.fillText("黑头 "+th.data.blackhead_num, 52*b* rpx, 440*b* rpx); - context.fillText("色斑 "+th.data.speckle_num, 354*b* rpx, 440*b* rpx); - - //左右俩个框并填充文字 - th.darwRoundRect(60 *b* rpx,484*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); - th.darwRoundRect(328 *b* rpx,484*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); - context.setFillStyle("black") - context.fillText("皱纹 "+th.data.wrinkle_num, 74*b* rpx, 510*b* rpx); - context.fillText("痤疮 "+th.data.acne_num, 344*b* rpx, 510*b* rpx); - - //底部的绘制 - th.darwRoundRect(38 *b* rpx,650*b*rpx,430*b*rpx,160*b*rpx,10*b*rpx,context); - //绘制二维码 - context.drawImage(vpath, 60*b*rpx, 672*b*rpx, 120 *b* rpx, 120 *b* rpx); - context.setFillStyle("black") - context.setFontSize(32*b*rpx) - context.fillText("美肤管家AI测肤", 200*b* rpx, 726*b* rpx); - context.setFontSize(22*b*rpx) - context.fillText("科学了解皮肤的真实状态", 200*b* rpx, 766*b* rpx); - - //把画板内容绘制成图片,并回调 画板图片路径 - context.draw(false, function () { - setTimeout(function () { - wx.canvasToTempFilePath({ - x: 0, - y: 0, - width: 750, - height: 1338, - destWidth: 1.4 * 750 * 750 / th.data.screenWidth, - destHeight: 1.4 * 750 * 750 / th.data.screenWidth, - canvasId: 'share', - success: function (res) { - that.setData({ - shareImgPath: res.tempFilePath, - canvasHidden: true, - share_show:1 - }) - return false; - - /*-- - wx.previewImage({ - //将图片预览出来 - ur--*/ - - wx.hideLoading(); + + var b = 1.1; + //获取到二维码的图片 + var vpath = res.path; + var context = wx.createCanvasContext('share'); + // 先画背景 + context.fillStyle = '#ebf6f8'; + // 灰色实心矩形 + // 1. 语法: x坐标, y坐标, 宽度, 高度 + context.fillRect(0, 0, 750 * rpx, 1338 * rpx); + + context.setFontSize(20 * rpx) + context.setFillStyle("#00d8e9") + context.fillText("官方检测认证", 28 * b * rpx, 80 * b * rpx); + + //两个底部颜色 + context.fillStyle = '#a7ecf5'; + context.fillRect(28 * b * rpx, 136 * b * rpx, 262 * b * rpx, 18 * b * rpx); + context.fillRect(28 * b * rpx, 194 * b * rpx, 262 * b * rpx, 18 * b * rpx); + + context.setFontSize(42 * b * rpx) + context.setFillStyle("#070609") + context.fillText("我的肌底强韧", 30 * b * rpx, 140 * b * rpx); + context.fillText("肌肤鲜活润泽", 30 * b * rpx, 196 * b * rpx); + + //先画一个圆形 + th.circle(context, 110 * b * rpx, 280 * b * rpx, 140 * b * rpx, "#e7f3f8"); + th.circle(context, 130 * b * rpx, 300 * b * rpx, 120 * b * rpx, "#c8f2fa"); + //绘制人脸 + context.drawImage(th.data.share_head, 132 * b * rpx, 310 * b * rpx, 230 * b * rpx, 230 * b * rpx); + + //左右俩个框并填充文字 + th.darwRoundRect(38 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); + th.darwRoundRect(324 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); + context.setFontSize(20 * b * rpx) + context.setFillStyle("black") + context.fillText("黑眼圈 重度", 50 * b * rpx, 368 * b * rpx); + context.fillText("毛孔 " + th.data.pore_num, 336 * b * rpx, 368 * b * rpx); + + //左右俩个框并填充文字 + th.darwRoundRect(40 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); + th.darwRoundRect(348 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); + context.setFillStyle("black") + context.fillText("黑头 " + th.data.blackhead_num, 52 * b * rpx, 440 * b * rpx); + context.fillText("色斑 " + th.data.speckle_num, 354 * b * rpx, 440 * b * rpx); + + //左右俩个框并填充文字 + th.darwRoundRect(60 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); + th.darwRoundRect(328 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); + context.setFillStyle("black") + context.fillText("皱纹 " + th.data.wrinkle_num, 74 * b * rpx, 510 * b * rpx); + context.fillText("痤疮 " + th.data.acne_num, 344 * b * rpx, 510 * b * rpx); + + //底部的绘制 + th.darwRoundRect(38 * b * rpx, 650 * b * rpx, 430 * b * rpx, 160 * b * rpx, 10 * b * rpx, context); + //绘制二维码 + context.drawImage(vpath, 60 * b * rpx, 672 * b * rpx, 120 * b * rpx, 120 * b * rpx); + context.setFillStyle("black") + context.setFontSize(32 * b * rpx) + context.fillText("美肤管家AI测肤", 200 * b * rpx, 726 * b * rpx); + context.setFontSize(22 * b * rpx) + context.fillText("科学了解皮肤的真实状态", 200 * b * rpx, 766 * b * rpx); + + //把画板内容绘制成图片,并回调 画板图片路径 + context.draw(false, function () { + setTimeout(function () { + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: 750, + height: 1338, + destWidth: 1.4 * 750 * 750 / th.data.screenWidth, + destHeight: 1.4 * 750 * 750 / th.data.screenWidth, + canvasId: 'share', + success: function (res) { + that.setData({ + shareImgPath: res.tempFilePath, + canvasHidden: true, + share_show: 1 + }) + /*-- + wx.previewImage({ + //将图片预览出来 + ur--*/ + + wx.hideLoading(); } }) }, 500) @@ -933,6 +1000,14 @@ Page({ }) }, + show_yiwen_dialog(e) { + let yiwen_type = e.currentTarget.dataset.yiwen_type; + this.setData({ + question_dialog: true, + yiwen_type, + }) + }, + //-----领取券----- get_quan: function (e) { diff --git a/packageD/pages/AI-test-skin/success_result/success_result.wxml b/packageD/pages/AI-test-skin/success_result/success_result.wxml index 3c7619d..a0ab3df 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.wxml +++ b/packageD/pages/AI-test-skin/success_result/success_result.wxml @@ -70,8 +70,8 @@ {{s_filter.get_dryoil_check(skin_dryoil_check_type)}} - 干性区 - 油性区 + 干性区 + 油性区 你的皮肤油脂过剩,部分干燥,容易引发皮肤问题。日常可使用一些具有控油和补水功效产品,帮助调理肌肤 @@ -119,22 +119,21 @@ - - + + - + - + @@ -147,8 +146,7 @@ - + @@ -172,11 +170,11 @@ - + - + @@ -199,12 +197,12 @@ - + - +
@@ -229,55 +227,63 @@ + - + - - - - 血管型 - - - - - 色素型 - - - - - 阴影型 - + + + + 血管型 + + + + + 色素型 + + + + + 阴影型 + - 毛孔粗大{{pore_num}} - 色斑{{speckle_num}} + 毛孔粗大:{{pore_num}} + 色斑:{{speckle_num}} - 全部皱纹{{wrinkle_num}} - 抬头纹{{wrinkle_num1}} - 川字纹{{wrinkle_num2}} - 眼周细纹{{wrinkle_num3}} - 鱼尾纹{{wrinkle_num4}} - 法令纹{{wrinkle_num5}} - 口周纹{{wrinkle_num6}} + 全部皱纹:{{wrinkle_num}} + 抬头纹:{{wrinkle_num1}} + 川字纹:{{wrinkle_num2}} + 眼周细纹:{{wrinkle_num3}} + 鱼尾纹:{{wrinkle_num4}} + 法令纹:{{wrinkle_num5}} + 口周纹:{{wrinkle_num6}} - 黑头{{blackhead_num}} + 黑头:{{blackhead_num}} - 黑眼圈 {{s_filter.get_dark_type(dark_type)}} - 左眼黑眼圈 {{s_filter.get_dark_type(dark_type1)}} - 右眼黑眼圈 {{s_filter.get_dark_type(dark_type2)}} + 黑眼圈:{{s_filter.get_dark_type(dark_type)}} + 左眼黑眼圈:{{s_filter.get_dark_type(dark_type1)}} + 右眼黑眼圈:{{s_filter.get_dark_type(dark_type2)}} - 全部痤疮{{acne_num}} - 粉刺{{acne_num1}} - 痘印{{acne_num2}} - 脓包{{acne_num3}} - 结节{{acne_num4}} + 全部痤疮:{{acne_num}} + 粉刺:{{acne_num1}} + 痘印:{{acne_num2}} + 脓包:{{acne_num3}} + 结节:{{acne_num4}} - 敏感度{{s_filter.get_nai_shou(skin_sensitive_check)}} + 敏感度:{{s_filter.get_nai_shou(skin_sensitive_check)}} @@ -293,21 +299,17 @@ - + {{item.name}} - -
- - - + + @@ -330,11 +332,11 @@ - + - + @@ -357,7 +359,7 @@ - + @@ -379,12 +381,39 @@ - - + + + + + + + + + + {{item.name}} + + {{item.des}} + + + + + + + + + + {{item.name}} + + + + + + + \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/success_result/success_result.wxss b/packageD/pages/AI-test-skin/success_result/success_result.wxss index caadbb1..24be046 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.wxss +++ b/packageD/pages/AI-test-skin/success_result/success_result.wxss @@ -11,6 +11,7 @@ page { z-index: 99; display: flex; height: 100rpx; + background-color: #fff; } .share { @@ -18,12 +19,13 @@ page { position: fixed; bottom: 100rpx; right: 0; - padding: 20rpx; + padding:8rpx 20rpx; background-color: #fff; border: 2rpx solid #f0f0f0; /* color: #FFF; */ border-radius: 40rpx 0 0 40rpx; z-index: 99; + align-items: center; } .tab_scroll_item { @@ -274,9 +276,6 @@ page { /* border-radius: 50%; */ } -.bold { - font-weight: 600; -} .analyse_result .gan::before { @@ -450,8 +449,7 @@ page { transform: translate(50%, -50%); height: 80%; width: 80%; - border-top-left-radius: 12rpx; - border-top-right-radius: 12rpx; + border-radius: 18rpx; z-index: 99999999; overflow: hidden; } @@ -466,15 +464,16 @@ page { flex-direction: column; justify-content: space-evenly; background-color: #fff; - min-height: 25%; + min-height: 10%; } .dialog_txt .heiyanquan_img { justify-content: space-between; padding: 2%; } + .dialog_txt .heiyanquan_img .img1 { - width: 32%; + width: 32%;color: #777; } .dialog .dialog_progress { @@ -490,9 +489,10 @@ page { .dialog_item { position: relative; - padding: 3% 6%; + padding: 3% 5%; white-space: nowrap; background-color: #fff; + color: #a9a9a9; } .dialog .dialog_icon { @@ -516,6 +516,46 @@ page { height: 50rpx; } +.cuochuang { + padding: 20rpx 30rpx; + position: absolute; + bottom: 50rpx; + left: 35rpx; + border-radius: 10rpx; + background-color: rgba(0, 0, 0, .2); + font-size: 24rpx; + color: #fff; +} + +.cuochuang_icon.cuochuang_icon { + margin-bottom: 10rpx; +} + +.cuochuang .cuochuang_icon::before { + content: ""; + margin-right: 15rpx; + display: inline-block; + width: 16rpx; + height: 16rpx; + /* border: 2rpx solid red; */ +} + +.cuochuang_icon:nth-child(1)::before { + border: 3rpx solid #d12126; +} + +.cuochuang_icon:nth-child(2)::before { + border: 3rpx solid #fff342; +} + +.cuochuang_icon:nth-child(3)::before { + border: 3rpx solid #d83fe4; +} + +.cuochuang_icon:nth-child(4)::before { + border: 3rpx solid #80c36c; +} + .pp { width: 8rpx; height: 40rpx; @@ -697,7 +737,7 @@ page { line-height: 80rpx; text-align: center; color: #fff; - background-color: #c3172d + background-color: #45d4eb } .sh_close { @@ -715,38 +755,114 @@ page { color: #fff } -@font-face { - font-family: "iconfont"; - /* Project id */ - src: url('iconfont.ttf?t=1645607343376') format('truetype'); +.e_tou { + width: 50rpx; + height: 20rpx; + border-radius: 50%; + top: 70rpx; + left: 78rpx +} + +.e_bz { + width: 18rpx; + height: 40rpx; + border-radius: 50%; + top: 100rpx; + left: 93rpx +} + +.e_zlian { + width: 20rpx; + height: 30rpx; + border-radius: 50%; + top: 126rpx; + left: 60rpx +} + +.e_ylian { + width: 20rpx; + height: 30rpx; + border-radius: 50%; + top: 126rpx; + left: 126rpx +} + +.e_xb { + width: 20rpx; + height: 16rpx; + border-radius: 50%; + top: 170rpx; + left: 92rpx } -.icon-close:before { - content: "\e668"; +.g_x { + background-color: #c0e2b7 } -.e_tou{width: 50rpx; height: 20rpx;border-radius: 50%; top: 70rpx; left: 78rpx} -.e_bz{width: 18rpx; height: 40rpx;border-radius: 50%; top: 100rpx; left: 93rpx} -.e_zlian{width: 20rpx; height: 30rpx;border-radius: 50%; top: 126rpx; left: 60rpx} -.e_ylian{width: 20rpx; height: 30rpx; border-radius: 50%; top: 126rpx; left: 126rpx} -.e_xb{width: 20rpx; height: 16rpx; border-radius: 50%; top: 170rpx; left: 92rpx} +.y_x { + background-color: #ffd6bd +} -.g_x{ background-color: #c0e2b7 } -.y_x{ background-color: #ffd6bd } +.acne_show_li { + border-radius: 10rpx; + position: absolute; + left: 10rpx; + bottom: 10rpx; + font-size: 20rpx; + color: #fff; + background-color: rgba(0, 0, 0, 0.5); + padding: 30rpx +} -.acne_show_li{ border-radius: 10rpx; position: absolute; left: 10rpx; bottom: 10rpx; - font-size: 20rpx;color: #fff;background-color: rgba(0,0,0,0.5);padding: 30rpx} +.acne_show_li_item { + width: 10rpx; + height: 10rpx; + border-radius: 50%; + display: inline-block; + margin-right: 10rpx +} -.acne_show_li_item{width: 10rpx; height: 10rpx;border-radius: 50%;display: inline-block;margin-right: 10rpx} -.p_circle.colore0{ - border: 4rpx solid #c8162c; +.p_circle.colore0 { + border: 4rpx solid #c8162c; } -.p_circle.colore1{ + +.p_circle.colore1 { border: 4rpx solid #E1E10B; } -.p_circle.colore2{ + +.p_circle.colore2 { border: 4rpx solid #4E8DF6; } -.p_circle.colore3{ + +.p_circle.colore3 { border: 4rpx solid #c0e2b7; -} \ No newline at end of file +} + +.yiwen { + font-size: 42rpx; + display: flex; + align-items: center; +} + +.yiwen_img { + width: 100%; + margin-top: 40rpx; + /* width: 600rpx; + height: 600rpx; */ +} + +.mt50 { + margin-top: 50rpx; +} + +.close_icon { + top: 15px; + position: absolute; + right: 50rpx; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} diff --git a/packageD/pages/AI-test-skin/success_result/wrinkle/wrinkle.wxml b/packageD/pages/AI-test-skin/success_result/wrinkle/wrinkle.wxml index 8391b53..6588f7c 100644 --- a/packageD/pages/AI-test-skin/success_result/wrinkle/wrinkle.wxml +++ b/packageD/pages/AI-test-skin/success_result/wrinkle/wrinkle.wxml @@ -4,7 +4,11 @@ #0{{wrinkle_sort}} - 皱纹 + + + 皱纹 + + 问题标注 diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index e6c1775..05e480a 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -61,11 +61,6 @@ Page({ }); } }) - // var user_id=getApp().globalData.user_id; - // if(!user_id) user_id=0; - // this.setData({ - // user_id, - // }) this.requestSalelist(); }, @@ -74,15 +69,7 @@ Page({ this.data.currentPage = 1; this.data.ismore = 1; var th = this; - // var userInfo = wx.getStorageSync('userinfo'); - // if (userInfo) { - // //调用列表 - // this.requestSalelist(userInfo.user_id); - // } else { - // getApp().goto("/pages/togoin/togoin"); - // } - //设置全局定时器 th.data.timer = setInterval(function () { th.countDown(); diff --git a/pages/activity/seckill_list/seckill_list.wxml b/pages/activity/seckill_list/seckill_list.wxml index 7c90784..2681e2b 100644 --- a/pages/activity/seckill_list/seckill_list.wxml +++ b/pages/activity/seckill_list/seckill_list.wxml @@ -33,13 +33,15 @@ - + + - {{item.goods_name}} + + {{item.goods_name}} @@ -71,9 +73,12 @@ - 即将开始 + + 即将开始 + 马上抢 + 已抢光 diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 7dec844..b79d639 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -1013,7 +1013,7 @@ Page({ console.log('add+'); if (a.goods_num < a.store_count) { var e = { - goods_num: a.goods_num + 1, + goods_num: a.goods_num + 1, id: a.id, goods_id: a.goods_id, store_id: oo.stoid @@ -1021,10 +1021,14 @@ Page({ // console.log('goods_num', e.goods_num); this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); } else { - wx.showModal({ - title: '提示', - content: '购买的数量不能超出库存数量', - }); + // wx.showModal({ + // title: '提示', + // content: '购买的数量不能超出库存数量', + // }); + wx.showToast({ + title: '购买的数量不能超出库存数量', + icon: 'none', + }); this.data.up_dating = 0; } }, @@ -1740,16 +1744,24 @@ Page({ }) - - var buyed_mum2 = t.goods_num + goodsbuynum; - if (buyed_mum2 > limit && limit > 0) { + //--> by ty + // var buyed_mum2 = t.goods_num + goodsbuynum; + var buyed_mum2 = t.goods_num; + //<-- + + // 判断当前预购买的数量是否超过可购买的数量 + if (buyed_mum2 > (limit - goodsbuynum) && limit > 0) { wx.showToast({ title: '购买数量超出商品限购', icon: 'none', - // content: '购买数量超出商品限购' }); var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - var cbuy = limit - buyed_mum2; + + //--> by ty + var cbuy = limit - goodsbuynum; + // var cbuy = limit - buyed_mum2 + 1; + //<-- + e.setData({ // [txt]: cbuy > 0 ? cbuy : 0, [txt]: cbuy > 0 ? cbuy : limit, diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index da36753..aff939d 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -4,9 +4,9 @@ --> - + input { /* border-right: 1px solid #000; */ - background-color: #f8f8f8; + background-color: #f0f0f0; border-radius: 8rpx; } .sub.active { diff --git a/pages/cart/cart2/c_filter.wxs b/pages/cart/cart2/c_filter.wxs index e8eda3e..01114fe 100644 --- a/pages/cart/cart2/c_filter.wxs +++ b/pages/cart/cart2/c_filter.wxs @@ -15,6 +15,7 @@ var filters = { if(ind==1 ) return "green"; if(ind==2) return "blue"; if(ind==11) return "green"; + if(ind==13) return "red"; if(ind==12) return "blue"; if(ind==20) return "green"; return ""; @@ -44,6 +45,7 @@ var filters = { if (ind == 2) return "指定品类"; if (ind == 11) return "指定用途"; if (ind == 12) return "指定分类1"; + if (ind == 13) return "全场通用"; if (ind == 20) return "指定单品"; return ""; }, diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index e4caecb..fcf119b 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -227,23 +227,6 @@ Page({ } else { th.setData({ user_addr: ie }); } - var going = 0; - - - //使用计时器,避免空现象 - /*--- - var jishi= setInterval(function () { - if (th.data.is_b_now == 1 && going==0) { - if(th.data.bn_goods) { - th.calculatePrice2();going=1;clearInterval(jishi); - } - }else if(going==0) { - if (th.data.cartlist){ - th.calculatePrice();going = 1; clearInterval(jishi); - } - } - },500)--*/ - }); var is_card_back = getApp().globalData.is_card_back; //--更新默认地址--,看一下是不是跳到地址页面,同时也不是购买等级卡返回的,这里很重要,否则会重新更新收货物流公司 @@ -392,6 +375,7 @@ Page({ th.setData({ user_addr: addr }); //--------------------------立即购买------------------ if (ta.is_bnow == 1) { + console.log('is_bnow'); //读取门店 to.get_allsto(function (e) { th.setData({ allsto: e }); @@ -404,6 +388,8 @@ Page({ to.get_allsto(function (e) { th.setData({ allsto: e }); //-------获取购物车已经选择的商品-------- + console.log('购物车结算'); + th.get_cart(); }) } @@ -533,7 +519,7 @@ Page({ } if (item1.prom_type == 10) { if (!th.data.ladder_map[item1.prom_id]) { - //如果有组合购 + //如果有预售 var isok = 1; var is_flag = 1; var act = null; @@ -984,7 +970,6 @@ Page({ if (gg.prom_type == 5) { t.data.data.prom_id = gg.prom_id; t.data.data.prom_type = 5; - // console.log('xxxxxxxxxxxxxxxxxx', gg.is_coupon) th.is_coupon = gg.is_coupon; th.setData({ @@ -1378,6 +1363,15 @@ Page({ wx.showLoading({ title: "处理中." }) + + //是不是区域包邮 + th.data.is_area_by=0; + //当不是区域不包邮的时候,没有不包邮商品的时候 + th.data.free1=0; + th.data.cut_o_shipping_price=0; + th.data.cut_goods_piece=0; + th.data.cut_goods_weight=0; + var all_price = 0; //所有的商品总价 var all_shipping_m = 0; //所有的物流总价 var all_total_m = 0; //所有的订单应付总价 @@ -1391,6 +1385,9 @@ Page({ var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0); var freight_free = ee.freight_free; //全场满多少包邮 + var free1=freight_free; + + var weight_free = ee.weight_free; //多少kg内包邮 var no_ex_id = ee.no_ex_id; var no_ex_good = null; @@ -1503,16 +1500,6 @@ Page({ } o_price += item[j].goods_price * item[j].goods_num; - //判断是否有设置限制重量包邮,先看商品有没有包邮 - if (item[j]['is_past'] !== 1 && item[j]['exp_sum_type'] == 2) { - if (goods_weight < 0) goods_weight = 0; - //累积商品重量 每种商品的重量 * 数量 - goods_weight += item[j]['weight'] * item[j]['goods_num']; - if (weight_free > 0) { - out_of_weight = (weight_free * 1000) - goods_weight; - } - } - } //判断是不是有组合购的金额 var f_o_price = o_price; @@ -1564,12 +1551,14 @@ Page({ th.data.is_no_past = 1; //不包邮标识符 + var no_ex_good_arr = null; //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额-- if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list)) { //如果有设置不包邮区域的时候 if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { if (th.check_by_area(by_qc.region_list)) { freight_free = 0; + th.data.is_area_by=1; //goods_weight = -1; //out_of_weight = 0; th.data.is_no_by[pickid] = 1; @@ -1580,11 +1569,67 @@ Page({ freight_free = 0; //goods_weight = -1; //out_of_weight = 0; - th.data.is_no_by[pickid] = 1; + //th.data.is_no_by[pickid] = 1; no_ex_good = by_qc.goods_list; + if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); } } + + + + var is_in_no_ex_goods_arr=0; + var by_g_weight=0; + //--------循环计算商品总物流----------- + for (var jo = 0; jo < item.length; jo++) { + //----------------如果是选择了物流--------------------- + if (cart_item.exp_type == 0 && item[jo].is_free_shipping == 0 && th.data.user_addr != null){ + + //判断是否有设置限制重量包邮,先看商品有没有包邮 + if(!no_ex_good_arr || no_ex_good_arr.indexOf(item[jo].goods_id + '')== -1){ + if(!th.data.is_area_by) th.data.free1=free1; + //此时是 模板里面没有不包邮商品列表或者是 该商品没有再不包邮商品列表礼包 + if (item[jo]['is_past'] !== 1 && item[jo]['exp_sum_type'] == 2) { + if (goods_weight < 0) goods_weight = 0; + //累积商品重量 每种商品的重量 * 数量 + goods_weight += item[jo]['weight'] * item[jo]['goods_num']; + by_g_weight+=item[jo]['weight'] * item[jo]['goods_num']; + + if(free1>0){ + if (weight_free > 0) { + out_of_weight = (weight_free * 1000) - by_g_weight; + }else{ + out_of_weight= -by_g_weight; + } + } + + } + } + //这个是在不包邮列表礼包 + else if(no_ex_good_arr.indexOf(item[jo].goods_id + '') > -1){ + is_in_no_ex_goods_arr=1; + if (item[jo]['is_past'] !== 1 && item[jo]['exp_sum_type'] == 2) { + if (goods_weight < 0) goods_weight = 0; + //累积商品重量 每种商品的重量 * 数量 + goods_weight += item[jo]['weight'] * item[jo]['goods_num']; + } + + } + } + } + + if(free1>0) { + //当商品没有超出的时候 + if (out_of_weight >= 0) { + out_of_weight = -by_g_weight; + } else { + if (weight_free > 0) out_of_weight = -weight_free * 1000; + } + } + + //所有的商品都不在不包邮商品列表,freight_free为0的时候,以及不是区域包邮 + if(!is_in_no_ex_goods_arr && !freight_free && !th.data.is_area_by) freight_free=free1; + //--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额-- if (cart_item.exp_type == 0 && th.data.user_addr != null && !cart_item.is_xz_yh) { //看是不是有调用过包邮券 @@ -1669,23 +1714,20 @@ Page({ if (no_ex_good) { is_good_no_by = th.check_by_goods(no_ex_good, item[j].goods_id); } - //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 并且没有超出重量 + /*-- if (o_price - quan_price >= freight_free && freight_free > 0 && !is_good_no_by && th.data.is_no_by[pickid] != 1 && out_of_weight >=0 ) { continue; - } - + }--*/ //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1 && !is_good_no_by) { continue; } - var no_ex_good_arr = null; - if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); - + //var no_ex_good_arr = null; + //if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); //----------------如果是选择了物流--------------------- - if (cart_item.exp_type == 0 && item[j].is_free_shipping == 0 && (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') > -1)) { - + if (cart_item.exp_type == 0 && item[j].is_free_shipping == 0) { //如果地址不为空 if (th.data.user_addr != null) { switch (item[j]['exp_sum_type']) { @@ -1693,14 +1735,6 @@ Page({ //统一运费 o_shipping_price += item[j]['uniform_exp_sum']; break; - // case 2: - // if (goods_weight < 0) goods_weight = 0; - // //累积商品重量 每种商品的重量 * 数量 - // goods_weight += item[j]['weight'] * item[j]['goods_num']; - // if (weight_free > 0) { - // out_of_weight = (weight_free * 1000) - goods_weight; - // } - // break; case 3: if (goods_piece < 0) goods_piece = 0; //累积商品数量 @@ -1708,12 +1742,28 @@ Page({ break; } } - }else{ + + if(!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '')== -1){ + switch (item[j]['exp_sum_type']) { + case 1: + //统一运费 + th.data.cut_o_shipping_price += item[j]['uniform_exp_sum']; + break; + case 3: + //累积商品数量 + th.data.cut_goods_piece += item[j]['goods_num']; + break; + } + } + + + }else{ + /*-- if(item[j]['exp_sum_type']==2 && out_of_weight!==0){ goods_weight = -1; out_of_weight = 0; - } + }--*/ } } @@ -1753,8 +1803,6 @@ Page({ o_condition = o_price_no_zh - quan_price; } - - var order_m = 0; //---判断是不是有订单优惠--- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { @@ -3124,6 +3172,14 @@ Page({ var fw_price = 0, fp_price = 0; item = item.config; if (item == null) return o_shipping_price; + + //------超出重量---------- + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { + goods_weight=goods_weight+ out_of_weight; + if(goods_weight==0) goods_weight=-1; + } + + //------按重量---------- if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); @@ -3133,16 +3189,13 @@ Page({ fw_price = fw_price + n * parseFloat(item['add_money']); } } - //------超出重量---------- - if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { - fw_price = parseFloat(item['money']); - var out_of_weight = Math.abs(out_of_weight); - if (out_of_weight > item['first_weight']) { - var fw = out_of_weight - item['first_weight']; - var n = Math.ceil(fw / item['second_weight']) - fw_price = fw_price + n * parseFloat(item['add_money']); - } - } + + if(th.data.free1 && freight_free<=0) freight_free=th.data.free1; + + + //当有包邮和不包邮混合在一起的时候,件数要重新计算 + if(freight_free>0 && o_price >= freight_free && goods_piece>0 && th.data.cut_goods_piece) + goods_piece=goods_piece-th.data.cut_goods_piece; //------按件数---------- if (goods_piece > 0 && item['piecemoney']) { fp_price = parseFloat(item['piecemoney']); @@ -3152,6 +3205,9 @@ Page({ fp_price = fp_price + m * parseFloat(item['add_piecemoney']); } } + //当有包邮和不包邮混合在一起的时候,统一运费要重新计算 + if(freight_free>0 && o_price >= freight_free && th.data.cut_o_shipping_price && price>0) price=price-th.data.cut_o_shipping_price; + var rspice = parseFloat(price + fw_price + fp_price); return rspice; }, @@ -3715,7 +3771,7 @@ Page({ for (var i in goodlist) { var gd = goodlist[i]; //--如果是秒杀就跳出,如果是赠品,如果是组合购,如果是限制使用优惠券-- - if (gd.prom_type == 1 || gd.is_gift || gd.prom_type == 7) { + if (gd.prom_type == 1 || gd.is_gift || (gd.prom_type == 7 && gd.act.is_xz_yh)) { continue; } diff --git a/pages/cart/cart2_inte/cart2_inte.js b/pages/cart/cart2_inte/cart2_inte.js index 75f3330..389ee79 100644 --- a/pages/cart/cart2_inte/cart2_inte.js +++ b/pages/cart/cart2_inte/cart2_inte.js @@ -161,19 +161,6 @@ Page({ } else { this.getuser_addr(function (ie) { - /*-- - //地址切换要把包邮券清空 - if( !th.data.user_addr || !ie || th.data.user_addr.address_id!=ie.address_id){ - var using_quan=th.data.using_quan; - for(var i in using_quan){ - var item=using_quan[i]; - if(item.isby==1){ - var ob={},txt="using_quan["+i+"]";ob[txt]={}; - th.setData(ob); - } - } - - }--*/ //th.data.prom_goods_map={}; //更换地址回来要重新调用计算价钱的接口 diff --git a/pages/distribution/distribution.js b/pages/distribution/distribution.js index 125b7a6..5dd2c3c 100644 --- a/pages/distribution/distribution.js +++ b/pages/distribution/distribution.js @@ -3,19 +3,6 @@ const app = getApp(); let self = null, os = app.globalData.setting; var regeneratorRuntime = require('../../utils/runtime.js'); -// Component({ -// pageLifetimes: { -// show() { -// if (typeof this.getTabBar === 'function' && this.getTabBar()) { -// this.getTabBar().setData({ -// active: 2 -// }) -// } -// } -// } -// }) - - Page({ /** @@ -243,14 +230,6 @@ Page({ }); }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - /** * 用户点击右上角分享 */ diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 34c9d82..93f7af1 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -29,6 +29,7 @@ Page({ first_leader: e.globalData.first_leader || 0, // 推荐人ID }, onLoad: function (options) { + var th = this; var my_confirm = th.selectComponent("#my_confirm"); //组件的id my_confirm.open_cancel(0); @@ -52,6 +53,7 @@ Page({ }) } + getApp().request.promiseGet("/api/weshop/ad/page?pid=901&store_id=" + os.stoid, { data: { enabled: 1 @@ -70,18 +72,19 @@ Page({ }); } }) - + }, onShow: function () { //--先判断会员状态-- - var user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - getApp().goto('/pages/togoin/togoin'); - return false; - } - this.getList(); - + getApp().is_Single_page(this,function(){ + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + getApp().goto('/pages/togoin/togoin'); + return false; + } + this.getList(); + }) }, //购买礼包 diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 06a7141..b5eaf11 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -40,7 +40,7 @@ Page({ getUserID: d.user_id, }) - if(options.lbId) th.data.lbId=options.lbId; + if (options.lbId) th.data.lbId = options.lbId; //-- 获取分享人的ID -- var first_leader = options.first_leader || getApp().globalData.first_leader; if (first_leader) { @@ -60,18 +60,19 @@ Page({ }, onShow: function () { - //--先判断会员状态-- - var user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - getApp().goto('/pages/togoin/togoin'); - return false; - } - if (this.data.isBuy == 0) { - this.GetMyGiftList(); - } else { - this.GetBuyGiftList(); - } - + getApp().is_Single_page(this,function () { + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + getApp().goto('/pages/togoin/togoin'); + return false; + } + if (this.data.isBuy == 0) { + this.GetMyGiftList(); + } else { + this.GetBuyGiftList(); + } + }) }, GetBuyPrice: function (e) { var that = this.data; @@ -415,13 +416,13 @@ Page({ if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; } - pagePath += "?isBuy=1" + "&lbId=" + this.data.getGiftID + "&first_leader="+ this.data.getUserID; + pagePath += "?isBuy=1" + "&lbId=" + this.data.getGiftID + "&first_leader=" + this.data.getUserID; // if (this.data.isBuy == 0) { // pagePath += "&orderSn=" + this.data.orderSn; // } else { // pagePath += "&lbId=" + this.data.getGiftID; // } - // console.log('pagePath', pagePath); + // console.log('pagePath', pagePath); return { title: "礼包详情", path: pagePath, @@ -437,12 +438,13 @@ Page({ if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; } - pagePath += "?isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader="+ this.data.getUserID; + pagePath += "?isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader=" + this.data.getUserID; // if (this.data.isBuy == 0) { // pagePath += "&orderSn=" + this.data.orderSn; // } else { // pagePath += "&lbId=" + this.data.getGiftID; // } + console.log('pagePath', pagePath); return { title: "礼包详情", path: pagePath, @@ -496,7 +498,7 @@ Page({ getApp().my_warnning(res.data.msg, 0, th); } }, - function (res) {} + function (res) { } ) }) diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 0fb7f7d..bb6574b 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -74,12 +74,15 @@ Page({ }, onShow: function() { //--先判断会员状态-- - var user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - getApp().goto('/pages/togoin/togoin'); - return false; - } - this.getList(); + getApp().is_Single_page(this,function () { + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + getApp().goto('/pages/togoin/togoin'); + return false; + } + this.getList(); + }) + }, getList: function() { diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index e3d1305..03a553e 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -655,18 +655,7 @@ Page({ var _errImg = e.target.dataset.errorimg; var idx = e.target.dataset.idx; var pix = e.target.dataset.pix; - // for(var i=0;i< list.length;i++){ - // for(var j=0;j { - let pd_list = res.data.data.pageData; if (res.data.code == 0 && pd_list.length > 0) { flag = pd_list.some(pd => { @@ -3773,6 +3814,20 @@ Page({ return param < 10 ? '0' + param : param; }, + // 显示拼单规则 + showRules: function() { + this.setData({ + showRules: true, + }); + }, + + // 关闭拼单规则 + closeRules: function() { + this.setData({ + showRules: false, + }); + }, + //----倒计时函数----- countDown(time, prom_st) { if (!this.data.is_timer) return false; @@ -4306,6 +4361,7 @@ Page({ go_cj_team: function (e) { var ind = e.currentTarget.dataset.ind; var item = this.data.teamgroup[ind]; + var goods_id = e.currentTarget.dataset.goodsid; var id = item.id; var th = this; @@ -4350,15 +4406,17 @@ Page({ getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn); } else { + console.log(222,goods_id) wx.navigateTo({ - url: "/pages/team/team_show/team_show?tg_id=" + id, + url: "/pages/team/team_show/team_show?tg_id=" + id +"&goods_id="+goods_id, }); } } //--跳转到参团-- else { + console.log(1111,th.data.goods_id) wx.navigateTo({ - url: "/pages/team/team_show/team_show?tg_id=" + id, + url: "/pages/team/team_show/team_show?tg_id=" + id+"&goods_id="+goods_id, }); } } @@ -4463,12 +4521,44 @@ Page({ if (quan_list) { for (var ind in quan_list) { var ep = quan_list[ind]; - var start = ut.formatTime(ep.use_start_time, "yyyy-MM-dd"); - var end = ut.formatTime(ep.use_end_time, "yyyy-MM-dd"); - start = start.replace("00:00:00", ""); - end = end.replace("00:00:00", ""); + var start = ""; + var end = ""; + if(ep.endtype == 1){ + if(ep.starttype == 1) { + start = ut.formatTime(ut.gettimestamp()+3600*24*ep.startdays,"yyyy-MM-dd"); + }else{ + start = ut.formatTime(ut.gettimestamp(),"yyyy-MM-dd"); + } + if(ep.days > 0) { + end = ut.formatTime(ut.gettimestamp()+3600*24*ep.startdays+3600*24*ep.days,"yyyy-MM-dd"); + }else{ + end = "不限"; + } + }else { + if(ep.starttype == 1 ){ + start = ut.formatTime(ut.gettimestamp()+3600*24*ep.startdays,"yyyy-MM-dd"); + }else{ + if(ep.starttype == 0 && ep.use_start_time >0) { + start = ut.formatTime(ep.use_start_time ,"yyyy-MM-dd"); + }else{ + start = "不限" + } + } + + if(ep.use_end_time > 0 ) { + end = ut.formatTime(ep.use_end_time ,"yyyy-MM-dd"); + }else{ + end = "不限" + } + } quan_list[ind].start = start; quan_list[ind].end = end; + // var start = ut.formatTime(ep.use_start_time, "yyyy-MM-dd"); + // var end = ut.formatTime(ep.use_end_time, "yyyy-MM-dd"); + // start = start.replace("00:00:00", ""); + // end = end.replace("00:00:00", ""); + // quan_list[ind].start = start; + // quan_list[ind].end = end; } } @@ -4618,7 +4708,7 @@ Page({ context.setLineJoin('round'); //交点设置成圆角 context.setFillStyle("white") context.setTextAlign('left'); - context.fillText('强烈推荐', 64 * unit, 672 * unit); + context.fillText('强烈推荐', 64 * unit, 668 * unit); // 7.商品价格 let price = '¥' + this.data.data.shop_price; @@ -6521,6 +6611,22 @@ Page({ closeSpecModal_flash_normal: function () { this.setData({openSpecModal_flash_normal: 0}); - } + }, + + + // 预览海报 + previewPoster() { + wx.previewImage({ + current: this.data.shareImgPath, // 当前显示图片的http链接 + urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表 + }); + }, + + + + + + + }) diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index fb306f1..fa37630 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -6,6 +6,8 @@ + + 规则 {{item.name}} @@ -14,7 +16,7 @@ @@ -183,8 +184,8 @@ {{data.goods_name}} - @@ -215,7 +216,7 @@ - + @@ -265,9 +266,9 @@ - - + {{item.shop_price}} {{item.market_price}} @@ -233,7 +235,7 @@ - + {{item.shop_price}} {{item.market_price}} diff --git a/pages/goods/goodsList/goodsList.wxss b/pages/goods/goodsList/goodsList.wxss index 45f9716..8df7bb8 100644 --- a/pages/goods/goodsList/goodsList.wxss +++ b/pages/goods/goodsList/goodsList.wxss @@ -4,6 +4,7 @@ page { .container { color: #666; + overflow-x: visible; } .nav { @@ -41,13 +42,23 @@ page { } .search_fixed { - position: fixed; + box-sizing: border-box; + height: 114rpx; + position: sticky; top: 0; - width: 95%; + /* width: 95%; */ background-color: #f0f0f0; z-index: 999; } +.nav-box { + position: sticky; + top: 114rpx; + /* width: 95%; */ + background-color: #f0f0f0; + z-index: 999; +} + .ico-dir { width: 16rpx; height: 22rpx; diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js index fa3aab4..1776180 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -18,19 +18,23 @@ Page({ requestUrl: "", //hotWords: [ [ "手机", "小米", "iphone" ], [ "三星", "华为", "冰箱" ] ] hotWords: null, - + is_no_plus:1, tabname: "sort", //排序的字段 adname: "asc", //升降的字段 rq_data:null, - - - searchRecord: [], - keyword: '', - is_his:0, + searchRecord: [], + keyword: '', + is_his:0, + hiddenClear: true, }, onLoad: function(t) { this.data.rq_data=t; + if(t.o) { + this.data.rq_data.o = JSON.parse(t.o); + }; + + //接受有没有导购的参数 var first_leader=t.first_leader; if(first_leader){ @@ -43,8 +47,24 @@ Page({ }) } + //调用接口判断商家plus有没有过期 + rq.promiseGet("/store/storemoduleendtime/page?store_id=" + oo.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) + var th=this; - a.getConfig2(function(rs){ + a.getConfig2(function(rs) { var arr=new Array(),arr2=new Array(); if (rs.hot_keywords != null && ut.trim(rs.hot_keywords)!="" ){ var arr1 = rs.hot_keywords.split('|'); @@ -100,7 +120,7 @@ Page({ //扫一扫过来,显示搜索的内容 var s_key = t.s_key; if (s_key){ - s_key=s_key.trim(); + s_key=s_key.trim(); this.search(s_key); this.openSearchModal(); return; } @@ -112,14 +132,15 @@ Page({ url += "&ladder_id=" + t.ladder_id; this.setData({ baseUrl:url, - }) - } + } if (url != this.data.baseUrl) return this.requestSearch(url); this.openSearchModal(); // 获取历史搜索记录 - this.getHistorySearch(); + this.getHistorySearch(); }, + + changeTab: function(t) { var ord = t.currentTarget.dataset.href; var ad = t.currentTarget.dataset.ad; @@ -138,21 +159,44 @@ Page({ //-----------真的调用地址进行搜索------------ requestSearch: function(t) { + // console.log('t===>', t); if(this.data.loading) return false; this.data.loading=1; var e = this,th=e; - if(getApp().globalData.userInfo){ - t += "&user_id=" + getApp().globalData.userInfo.user_id; - } + if(getApp().globalData.userInfo) { + t += "&user_id=" + getApp().globalData.userInfo.user_id; + } this.data.requestUrl = t; var user_id=getApp().globalData.user_id; if(!user_id) user_id=0; - - getApp().request.promiseGet(t, {data:{is_mainshow: 1, isonsale: 1, store_id: oo.stoid,orderField: e.data.tabname, orderType: e.data.adname, page: e.data.currentPage}}).then(async res=>{ + let data = { + is_mainshow: 1, + isonsale: 1, + store_id: oo.stoid, + orderField: e.data.tabname, + orderType: e.data.adname, + page: e.data.currentPage, + }; + + let o = this.data.rq_data.o; + if(o) { + if(o.cat_id) data.cat_id = o.cat_id; + if(o.pid && o.pid != 'three') data.parent_id = o.pid; + if(o.nation_id) data.nation_id = o.nation_id; + if(o.brand_id) data.brand_id = o.brand_id; + }; + + + getApp().request.promiseGet(t, {data:data}).then(async res=>{ th.data.loading=0; if(ut.ajax_ok(res)){ - if(!e.data.requestData) e.data.requestData=[]; + if(!e.data.requestData) { + // e.data.requestData=[]; + e.setData({ + requestData: [], + }); + }; for(let i in res.data.data.pageData){ let item=res.data.data.pageData[i]; item.original_img = th.data.url + item.original_img; @@ -229,8 +273,8 @@ Page({ }) break; default: - break - } + break; + }; if(url!=null && url!=''){ await getApp().request.promiseGet(url, {}).then(async res => { var prom =null; @@ -249,11 +293,9 @@ Page({ item.prom_id=0; item.prom_price=null; } - - } }) - } + }; if(!th.data.requestData) th.data.requestData=[]; th.data.requestData.push(item); e.setData({requestData: e.data.requestData}); @@ -263,9 +305,13 @@ Page({ }) }, onReachBottom: function() { + console.log('触发上滑加载事件'); this.data.currentPage++ + console.log('触发上滑加载事件currentPage',this.data.currentPage); this.data.openSearchModal || e.canloadMore() && this.requestSearch(this.data.requestUrl); }, + + openFilterModal: function() { this.setData({ openFilterModal: !0 @@ -279,8 +325,16 @@ Page({ filterGoods: function(t) { this.resetData(), this.requestSearch(t.currentTarget.dataset.href), this.closeFilterModal(); }, + + + resetData: function() { - e.resetConfig(), this.data.requestData = null, this.data.currentPage = 1; + e.resetConfig(), + // this.data.requestData = null, + this.data.currentPage = 1; + this.setData({ + requestData: null, + }); }, //---回复最初的设置---显示全部分类-- @@ -300,32 +354,37 @@ Page({ openSearchModal: !1 }); }, + submitSearch: function(t) { - console.log(111,t); - var val=t.detail.value.word; - if(val==undefined) val=t.detail.value; - val=val?val.trim():''; - if(!val){ - a.showWarning("请输入搜索关键词"); - } - this.search(val); - + var val=t.detail.value.word; + if(val==undefined) val=t.detail.value; + val=val?val.trim():''; + if(!val){ + a.showWarning("请输入关键词"); + } + this.search(val); }, //热搜关键字 searchHotWord: function(t) { - - var word= t.currentTarget.dataset.word; - this.historyRecord(word); + var word = t.currentTarget.dataset.word; + if(word) { + this.setData({ + keyword: word, + hiddenClear: false, + }); + }; + this.historyRecord(word); this.search(word); }, //-----点击搜索按钮---- search: function(t) { - if ("string" != typeof t || "" == t) return a.showWarning("请输入搜索关键词"); + if ("string" != typeof t || "" == t) return a.showWarning("请输入关键词"); this.data.key_str=t; - this.historyRecord(); - this.resetData(), this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t)); + this.resetData(); + this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t)); + this.historyRecord(); }, //---------分享配置-------- @@ -349,7 +408,7 @@ Page({ } } - console.log("11-11"+pagePath); + // console.log("11-11"+pagePath); return { title: "商品搜索", path:pagePath, @@ -393,9 +452,18 @@ Page({ getInput(e) { - this.setData({ - keyword: e.detail.value - }); + let val = e.detail.value; + if(val) { + this.setData({ + keyword: e.detail.value, + hiddenClear: false, + }); + } else { + this.setData({ + hiddenClear: true, + }); + } + }, historyRecord(w) { @@ -449,13 +517,14 @@ Page({ - + // 获取历史搜索记录 getHistorySearch() { this.setData({ searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空 }); }, + // 清除历史搜素记录 clearSearchRecord() { wx.clearStorageSync('searchRecord'); this.setData({ @@ -466,5 +535,19 @@ Page({ go_url:function (e) { var url=e.currentTarget.dataset.url; getApp().goto(url); - } + }, + + clearInput() { + this.setData({ + keyword: '', + hiddenClear: true, + openSearchModal: true, + }); + }, + + inputFocus() { + this.setData({ + openSearchModal: true, + }); + }, }); \ No newline at end of file diff --git a/pages/goods/search/search.wxml b/pages/goods/search/search.wxml index 6b27d1c..c645425 100644 --- a/pages/goods/search/search.wxml +++ b/pages/goods/search/search.wxml @@ -1,32 +1,80 @@ + - - - - - - - - - + + +
+ + + + + + + +
+
+ + + + + + + 历史搜索 + + + + + {{item}} + + + 暂无历史搜索记录 + + + + 热门搜索 + + + {{item}} + + + + + + + + + + + + + + + + + + + + @@ -76,7 +124,7 @@
- + ¥{{item.shop_price}} ¥{{item.market_price}} @@ -113,15 +161,17 @@
-
- - - 没有相关的数据 - 去逛逛 - + + + + 没有相关的数据 + 去逛逛 + + +
- - - - -
- - -
-
- - 热门搜索 - - - {{item}} - - - - - - 历史搜索 - - - - - {{item}} - - - 暂无历史搜索记录 - -
\ No newline at end of file diff --git a/pages/goods/search/search.wxss b/pages/goods/search/search.wxss index 1711e17..2842aea 100644 --- a/pages/goods/search/search.wxss +++ b/pages/goods/search/search.wxss @@ -1,16 +1,25 @@ .container { color: #666; + overflow: visible; +} + +.nav { + position: sticky; + top: 90rpx; + background-color: white; + z-index: 999; } .nav-item { - float: left; + /* float: left; width: 30%; height: 90rpx; - line-height: 90rpx; + line-height: 90rpx; */ + padding: 14rpx 10rpx; display: flex; align-items: center; justify-content: center; - font-size: 32rpx; + font-size: 28rpx; border-bottom: 2rpx solid #E6E6E6; background-color: #fff; } @@ -160,7 +169,7 @@ } .search-modal { - position: fixed; + /* position: fixed; top: 0; right: 0; left: 0; @@ -170,12 +179,16 @@ overflow-x: hidden; padding: 80rpx 30rpx; font-size: 30rpx; - color: #555; + color: #555; */ } .search-bar { - width: 100%; - box-sizing: border-box; + /* width: 100%; + box-sizing: border-box; */ + background-color: white; + position: sticky; + top: 0; + z-index: 1; } .search-input { @@ -212,21 +225,21 @@ .hot-title { font-size: 35rpx; color: black; - margin-bottom: 30rpx; + /* margin-bottom: 30rpx; */ } .hot-row { display: flex; /*--justify-content: space-between---*/ - padding: 15rpx 10rpx; + padding: 10rpx 0; } .hot-item { - padding: 8rpx 8rpx; - border: 1rpx solid #e0e0e0; - border-radius: 10rpx; + padding: 6rpx 20rpx; + border: 2rpx solid #e0e0e0; + border-radius: 40rpx; font-size: 28rpx; - margin-left: 15rpx; + margin-right: 16rpx; } /* .card_bg { @@ -303,9 +316,69 @@ background-color: #f0f0f0; color: #7b7b7b; border: none; - margin-bottom: 8rpx; + margin-bottom: 16rpx; } .history:first-of-type { + /* margin-left: 0; */ +} + +.input-box { + position: relative; + flex: 1; + padding-left: 50rpx; + padding-right: 70rpx; + background-color: #f0f0f0; + border-radius: 60rpx; +} + +.input-box::before { + font-family: iconfont; + position: absolute; + left: 20rpx; + top: 50%; + transform: translateY(-50%); + content: '\e618'; +} + +.input-search { + position: relative; + padding: 10rpx; + font-size: 28rpx; +} + + +.btn { margin-left: 0; + margin-right: 0; + line-height: 1; + padding: 20rpx; + font-size: 30rpx; +} + +.btn::after { + border: none; +} + +.icon-guan { + font-size: 20rpx; + padding: 10rpx; + position: absolute; + right: 20rpx; + top: 50%; + transform: translateY(-50%); +} + +.lookat { + display: inline-block; + color: #FF6768; + border: 2rpx solid #FF6768; + border-radius: 80rpx; + font-size: 30rpx; +} + +.no-data .no-data-title { + font-size: 28rpx; + color: #999; } + diff --git a/pages/index/index/index.js b/pages/index/index/index.js index ef632a6..dedb298 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -88,7 +88,6 @@ Page({ }, onLoad: async function (tt) { - var th = this; var first_leader = tt.first_leader; if (!first_leader && tt.scene) { diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index 766039d..2d0812a 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -172,21 +172,23 @@ - - - - - - - - - {{aitem.goods_name}} - - - {{aitem.price}} - ¥{{aitem.market_price}} - - + + + + + + + + + {{aitem.goods_name}} + + + {{aitem.price}} + ¥{{aitem.market_price}} + + + + diff --git a/pages/user/assistance/assistance.js b/pages/user/assistance/assistance.js index a4190df..1d13f42 100644 --- a/pages/user/assistance/assistance.js +++ b/pages/user/assistance/assistance.js @@ -28,18 +28,17 @@ Page({ timer: "", //任务列表的定时器 s_num: "", //多少人已经领取任务 page: 1, //我的任务的当前页 - - imageUrl:'', - btn_color:'', - bg_color:'', - font_color:'', + + imageUrl: '', + btn_color: '', + bg_color: '', + font_color: '', }, /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { - + onLoad: function (options) { var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.set_name("助力", "/pages/user/assistance/assistance"); @@ -49,34 +48,33 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow: function() { - + onShow: function () { //--先判断会员状态-- - var user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - getApp().goto('/pages/togoin/togoin'); - return false; - } + getApp().is_Single_page(this, function () { + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + getApp().goto('/pages/togoin/togoin'); + return false; + } + // 助力活动 + this.assistance(); + }) + }, - var th = this; - // 助力活动 - this.assistance(); + print() { + var user_id = getApp().globalData.user_id; + var store_id = os.stoid; + + getApp().request.promiseGet("/api/weshop/marketing/help/act/judge", { + data: { + storeId: store_id, + userId: user_id + } + }).then(res => { + console.log('res', res); + }); }, - - print() { - var user_id = getApp().globalData.user_id; - var store_id = os.stoid; - - getApp().request.promiseGet("/api/weshop/marketing/help/act/judge", { - data: { - storeId: store_id, - userId: user_id - } - }).then(res => { - console.log('res', res); - }); - }, - + // 助力活动 assistance() { var th = this; @@ -95,10 +93,10 @@ Page({ th.setData({ zl_act: help_data, help_id: help_data.id, - btn_color: help_data.btn_color, - bg_color: help_data.bg_color, - font_color: help_data.font_color, - imageUrl: help_data.imageUrl, + btn_color: help_data.btn_color, + bg_color: help_data.bg_color, + font_color: help_data.font_color, + imageUrl: help_data.imageUrl, }); if (th.data.help_id != "" && th.data.help_id != null) { //我的任务 @@ -111,11 +109,11 @@ Page({ storeId: store_id } }) - }else - getApp().my_warnning("暂无此活动或您不符合商家设置的会员参与对象,无法参与!", 0, th); + } else + getApp().my_warnning("暂无此活动或您不符合商家设置的会员参与对象,无法参与!", 0, th); return ut.null_promise(); }).then(res => { - if ( res && res.data &&res.data.code == 0) + if (res && res.data && res.data.code == 0) th.setData({ s_num: res.data.data.countAll }) @@ -125,13 +123,13 @@ Page({ }, //--点击获取用户任务列表--会员的任务列表 - get_list: function() { + get_list: function () { var th = this; var page = th.data.page; - if(page==1)th.data.zl_user_list=[]; + if (page == 1) th.data.zl_user_list = []; var help_id = this.data.help_id; - var r=Math.random()*100; + var r = Math.random() * 100; t.request.get("/api/weshop/marketing/help/help/user/page", { isShowLoading: true, data: { @@ -140,9 +138,9 @@ Page({ helpId: help_id, page: page, pageSize: 5, - r:r, + r: r, }, - success: function(res) { + success: function (res) { clearTimeout(th.data.timer); if (!th.data.is_load) @@ -181,17 +179,17 @@ Page({ }, //-----跳转到领取礼包的页面------ - go_task: function() { + go_task: function () { var th = this; var help_id = th.data.help_id; - if (!help_id){ - getApp().my_warnning("暂无此活动或您不符合商家设置的会员参与对象,无法参与!", 0, th); - return false; - } + if (!help_id) { + getApp().my_warnning("暂无此活动或您不符合商家设置的会员参与对象,无法参与!", 0, th); + return false; + } getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id); }, - switch_head: function(e) { + switch_head: function (e) { var th = this; var index = e.currentTarget.dataset.index; //获取当前选择的是任务还是活动说明 var switch_head = th.data.switch_head; //0任务,1活动说明 @@ -203,50 +201,50 @@ Page({ }, //关闭导航 - close: function() { + close: function () { var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.close_box(); }, // 领取礼包 - get_libao: function(e) { + get_libao: function (e) { var help_id = e.currentTarget.dataset.help_id;//活动id var taskId = e.currentTarget.dataset.taskid;//任务id var id = e.currentTarget.dataset.id;//用于跳到礼包详情一键全部领取用的任务id - getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 1 + "&taskId=" + taskId+"&id="+id); + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 1 + "&taskId=" + taskId + "&id=" + id); }, //查看礼包id - select_libao: function(e) { + select_libao: function (e) { var orderSn = e.currentTarget.dataset.ordersn; //订单号 getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn); }, //---查看任务--- - go_to_task:function (e) { + go_to_task: function (e) { var help_id = this.data.help_id; - var taskid=e.currentTarget.dataset.taskid; - getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id+"&taskid="+taskid); + var taskid = e.currentTarget.dataset.taskid; + getApp().goto("/pages/user/assistance/task_assistance?help_id=" + help_id + "&taskid=" + taskid); + }, + + onShareAppMessage(res) { + if (res.from === 'button') { + // 来自页面内转发按钮 + console.log(res.target) + } + return { + // title: '自定义转发标题', + } + }, + + onShareTimeline() { + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; + if (!store_name) + store_name = getApp().globalData.setting.appName; + return { + title: '好友助力-' + store_name, + } }, - - onShareAppMessage(res) { - if (res.from === 'button') { - // 来自页面内转发按钮 - console.log(res.target) - } - return { - // title: '自定义转发标题', - } - }, - - onShareTimeline() { - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; - if(!store_name) - store_name=getApp().globalData.setting.appName; - return { - title: '好友助力-' + store_name, - } - }, }) diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index 76eaf67..7857e94 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -441,13 +441,7 @@ Page({ var user_list = su.data.data.pageData; - // if (user_list == "" || user_list.length == 0 || user_list==null){ - // th.setData({ - // is_user_list: 1 - // }); - // console.log("走哪里1111"); - // }else{} - console.log("走哪里22222222"); + var user_lists = th.data.user_task_list.concat(user_list); th.setData({ user_task_list: user_lists diff --git a/pages/user/cardinfo/cardinfo.js b/pages/user/cardinfo/cardinfo.js index 7c9780e..7979aad 100644 --- a/pages/user/cardinfo/cardinfo.js +++ b/pages/user/cardinfo/cardinfo.js @@ -727,14 +727,19 @@ Page({ //--转到用户余额-- to_user_money:function(){ - this.setData({yu_e_show:1}) + //提现小于0的值也不提现 + if(!this.data.free.VIPRebate || parseFloat(this.data.free.VIPRebate)<=0){ + getApp().my_warnning("您目前没有可提现的金额",0,th); return false; + } + this.setData({yu_e_show:1}) }, close_yu_e:function(){ this.setData({yu_e_show:0}) }, go_yu_e:function(){ var th=this,free=th.data.free; - if(!th.data.free.VIPRebate){ + //提现小于0的值也不提现 + if(!th.data.free.VIPRebate || parseFloat(th.data.free.VIPRebate)<=0){ getApp().my_warnning("您目前没有可提现的金额",0,th); return false; } wx.showModal({ diff --git a/pages/user/coupons/coupons.wxml b/pages/user/coupons/coupons.wxml index 4af8c9e..0e79d2a 100644 --- a/pages/user/coupons/coupons.wxml +++ b/pages/user/coupons/coupons.wxml @@ -1,57 +1,6 @@ - - - - - - - - - - - diff --git a/pages/user/index/index.js b/pages/user/index/index.js index f2acb92..2fa7e06 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -25,6 +25,7 @@ Page({ txmon: 0, byquan: 0, yuer: 0, + is_no_plus:1, currentPage: 1, recommend_list: [], tc_hide: true, @@ -41,7 +42,9 @@ Page({ actImg: "", is_assistance: 0, //助力活动 ad_img:"", - add_card_data:'', //等级卡的内容 + add_card_data:'', //等级卡的内容 + + }, goto_nav: function(e) { var th = this; @@ -58,39 +61,20 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { - var th=this; - //-- 读取会员中心按钮列表 -- - getApp().request.get("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { - success:function(res){ - if(ut.ajax_ok(res)) { - var d_list=res.data.data.pageData; - getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ - var dis=rs.data.data; - for(var i in d_list){ - if(d_list[i].name=='我的分销' && (!dis || dis.switch==0)){ - d_list.splice(i,1); - } - } - th.setData({user_tool:d_list}); - - getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { - data: { - enabled: 1 - }, - success:function(res){ - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ - var item=res.data.data.pageData[0]; - if (item && item.ad_code) th.setData({ad_img:item.ad_code}) - } - } - }) - - app.getUserFir(); - - }) - } - } - }) + var th=this; + getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { + data: { + enabled: 1 + }, + success:function(res){ + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ + var item=res.data.data.pageData[0]; + if (item && item.ad_code) th.setData({ad_img:item.ad_code}) + } + } + }) + app.getUserFir(); + this.init_user_tool() }, @@ -98,10 +82,6 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { - - - - //看一下小程序是不是过期了 getApp().getConfig2(function(config2){ if(config2 && config2.is_overdue==1){ @@ -129,7 +109,21 @@ Page({ } }) - + //调用接口判断商家plus有没有过期 + rq.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) var th=this; // 判断是否开启美业 @@ -460,6 +454,8 @@ Page({ }, + + //判断会员是后有改服务项目 check_is_has_qy: function(item, g_qy_list) { if (!g_qy_list) return false; @@ -870,6 +866,42 @@ Page({ corpId: id, success(res) {} }) + }, + + //初始话按钮图标 + init_user_tool:async function () { + var d_list=null; + //读取user_tool按钮图标 + await getApp().promiseGet("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { + }).then(res=>{ + if(ut.ajax_ok(res)) { + d_list=res.data.data.pageData; + } + }) + if(!d_list) return false; + //过滤掉分销关闭的 + await getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ + if(rs.data.code==0){ + var dis=rs.data.data; + for(var i in d_list){ + if(d_list[i].name=='我的分销' && (!dis || dis.switch==0)){ + d_list.splice(i,1); + } + } + } + }) + + //判断右没有开AI测肤 + await getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+os.stoid,{}).then(rs=>{ + if(rs.data.code!=0 || !rs.data.data){ + for(var i in d_list){ + if(d_list[i].name=='AI测肤'){ + d_list.splice(i,1); + } + } + } + }) + this.setData({user_tool:d_list}); } diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index 32a1156..09ce4f3 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -10,9 +10,10 @@ - {{userInfo.nickname}} - - {{GradeName}} + {{userInfo.nickname}} + + {{GradeName}} + @@ -69,29 +70,31 @@ - + + - - - 加入plus会员预计可省3031元 - + + + 加入plus会员预计可省3031元 + 立即开通 - + - - - 加入plus会员预计可省3031元 - + + + 加入plus会员预计可省3031元 + 立即续费 - + + @@ -102,8 +105,8 @@ 我的订单 - - 您有{{countDadaOrder}}个同城配送订单 + + 您有{{countDadaOrder}}个同城配送订单 更多 @@ -152,7 +155,7 @@ - 我的权益 + 我的权益 @@ -168,32 +171,32 @@ - - - + + + - + - - + + - - - - {{item.PrivilegeName}} + + + + {{item.PrivilegeName}} + - - + - + - - + + + - - 未找到数据 + 未找到数据
@@ -202,87 +205,87 @@ - - + - + - + 工具与服务 - - - - - - - - - - PLUS会员 - - - - - - 助力活动 - - - - - - 我的权益 - - - - - - 套盒商品 - - - - - - {{item.name}} - - - - - - - - - - - 联系客服 - - - - - 联系客服 - - - - - - - 收入卡包 - - - - - + + + + + + + + + + PLUS会员 + + + + + + 助力活动 + + + + + + 我的权益 + + + + + + 套盒商品 + + + + + + {{item.name}} + + + + + + + + + + + 联系客服 + + + + + 联系客服 + + + + + + + 收入卡包 + + + + + @@ -306,15 +309,17 @@ - - - - - - - - 提供技术支持 - + + + + + + + + + 提供技术支持 + + @@ -327,7 +332,7 @@ {{userInfo.nickname}} - + {{userInfo.address}} @@ -341,4 +346,4 @@ - + \ No newline at end of file diff --git a/pages/user/index/index.wxss b/pages/user/index/index.wxss index 6a50033..5d208f0 100644 --- a/pages/user/index/index.wxss +++ b/pages/user/index/index.wxss @@ -372,6 +372,8 @@ margin-top: 30rpx; display: inline-block; line-height: 40rpx; + margin-left: 0 !important; + margin-right: 0 !important; } .xc-project-frame .xc-project { diff --git a/pages/user/my_service/beauty_deta.js b/pages/user/my_service/beauty_deta.js index 472f206..83ece7b 100644 --- a/pages/user/my_service/beauty_deta.js +++ b/pages/user/my_service/beauty_deta.js @@ -51,7 +51,8 @@ Page({ modify: options.modify, hours: hours, projectId: options.projectId, - storageId: storageId + storageId: storageId, + VipId:options.VipId, }) if (options.url != undefined) { th.setData({ diff --git a/pages/user/my_service/i_service.wxml b/pages/user/my_service/i_service.wxml index 8406e1a..360e6bb 100644 --- a/pages/user/my_service/i_service.wxml +++ b/pages/user/my_service/i_service.wxml @@ -99,4 +99,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/pages/user/my_service/tment_details.wxml b/pages/user/my_service/tment_details.wxml index a6c137b..bc3eed6 100644 --- a/pages/user/my_service/tment_details.wxml +++ b/pages/user/my_service/tment_details.wxml @@ -101,7 +101,7 @@ 我的服务 - + 更改时间 diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index 7392c72..e2736ee 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -49,6 +49,7 @@ Page({ fir_pick_index: 0, sec_pick_index: 0, is_gps: 1, + is_no_plus:1, lon: 0, only_pk: 0, open_ind_store: 0, //哪里打开的门店列表的控制属性 @@ -69,6 +70,10 @@ Page({ check_label: [], //我选择的兴趣标签 fir_guide_id:null, //存储会员详情接口出来的美导ID + userInfo: {}, + hasUserInfo: false, + canIUseGetUserProfile: false, + }, //通过路径跳转到其他页面 goto: function(e) { @@ -604,6 +609,7 @@ Page({ }, //------初始化加载---------- onLoad: function(t) { + let th= this; var user = getApp().globalData.userInfo; if (user.card_field != '' && user.card_field != null && user.card_field != undefined && user.card_expiredate) { var now = ut.gettimestamp(); @@ -614,8 +620,70 @@ Page({ this.puls_user(); } } + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + r.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) this.initial_user(); + // 获取用户昵称 + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + }, + + // 获取用户头像昵称 + getUserProfile(e) { + var th = this; + new Promise((resolve, reject) => { + wx.getUserProfile({ + desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + th.data.user.nickname = res.userInfo.nickName; + th.data.user.head_pic = res.userInfo.avatarUrl; + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true, + user: th.data.user, + }); + resolve(res.userInfo); + }, + + }); + }).then((userInfo) => { + getApp().request.put("/api/weshop/users/update", { + data: { + storeId: r.stoid, + user_id: getApp().globalData.user_id, + nickname: userInfo.nickName, + head_pic: userInfo.avatarUrl + + }, + success: function(su) { + if (su.data.code == 0) { + console.log("update user info OK"); + } + } + }); + }); + + + }, + + //-----------会员是否初始化--------------------- initial_user: function() { diff --git a/pages/user/userinfo/userinfo.wxml b/pages/user/userinfo/userinfo.wxml index adf65c3..2e82d7b 100644 --- a/pages/user/userinfo/userinfo.wxml +++ b/pages/user/userinfo/userinfo.wxml @@ -8,15 +8,18 @@ + - {{user.nickname}} + + {{user.nickname}} + - + @@ -33,6 +36,8 @@ + + diff --git a/pages/user/withdrawals/withdrawals.js b/pages/user/withdrawals/withdrawals.js deleted file mode 100644 index 532d51f..0000000 --- a/pages/user/withdrawals/withdrawals.js +++ /dev/null @@ -1,54 +0,0 @@ -var a = getApp(), n = a.request, e = require("../../../utils/common.js"); - -Page({ - data: { - url: a.globalData.setting.url, - userMoney: 0, - capacheUrl: "" - }, - onLoad: function(a) { - this.setData({ - userMoney: a.money - }), this.getCapache(); - }, - submitWithdrawals: function(a) { - var e = a.detail.value; - if (!0 === this.checkFormData(e)) { - var t = this; - n.post("/api/user/withdrawals", { - data: { - account_bank: e.account_bank, - account_name: e.account_name, - bank_name: e.bank_name, - money: e.money, - verify_code: e.verify_code, - paypwd: e.paypwd - }, - success: function() { - wx.showToast({ - title: "已提交申请", - mask: !0, - complete: function() { - setTimeout(function() { - wx.navigateBack(); - }, 1e3); - } - }); - }, - failStatus: function() { - t.getCapache(); - } - }); - } - }, - checkFormData: function(n) { - console.log(n); - var e = parseFloat(n.money); - return isNaN(e) ? a.showWarning("请填写合法的提现金额") : e < .01 ? a.showWarning("请填写大于等于1分的提现金额") : e > this.data.userMoney ? a.showWarning("可提现最大金额是 " + this.data.userMoney + " 元") : n.bank_name.length < 2 ? a.showWarning("请填写正确的银行名称") : isNaN(parseInt(n.account_bank)) || "" == n.account_bank ? a.showWarning("请填写正确的收款账号") : "" == n.account_name ? a.showWarning("请填写正确的开户号") : "" == n.paypwd.length ? a.showWarning("支付密码不能为空") : "" != n.verify_code || a.showWarning("请先输入验证码"); - }, - getCapache: function() { - this.setData({ - capacheUrl: e.getCapache() - }); - } -}); \ No newline at end of file diff --git a/pages/user/withdrawals/withdrawals.json b/pages/user/withdrawals/withdrawals.json deleted file mode 100644 index 7032d9c..0000000 --- a/pages/user/withdrawals/withdrawals.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "navigationBarTitleText": "申请提现" -} \ No newline at end of file diff --git a/pages/user/withdrawals/withdrawals.wxml b/pages/user/withdrawals/withdrawals.wxml deleted file mode 100644 index 72776d6..0000000 --- a/pages/user/withdrawals/withdrawals.wxml +++ /dev/null @@ -1,32 +0,0 @@ - -
- - 提现金额 : - - - - 银行名称 : - - - - 收款账号 : - - - - 开户号 : - - - - 支付密码 : - - - - 验证码 : - - - - - - -
-
diff --git a/pages/user/withdrawals/withdrawals.wxss b/pages/user/withdrawals/withdrawals.wxss deleted file mode 100644 index b8978e8..0000000 --- a/pages/user/withdrawals/withdrawals.wxss +++ /dev/null @@ -1,42 +0,0 @@ -.panel { - padding-bottom: 50rpx; -} - -.apply-item { - display: flex; - align-items: center; - font-size: 28rpx; - height: 88rpx; - border-bottom: 1px solid #ddd; -} - -.title { - color: #444; - margin-right: 20rpx; -} - -input { - color: #777; - width: 500rpx; -} - -.v-code-text { - width: 220rpx; -} - -.v-code { - width: 260rpx; - height: 60rpx; -} - -.apply-btn { - margin: 60rpx auto 0; - width: 580rpx; - height: 88rpx; - font-size: 28rpx; - line-height: 88rpx; - text-align: center; - color: #fff; - background-color: #e30000; - border-radius: 8rpx; -} \ No newline at end of file diff --git a/pages/user/withdrawals_list/withdrawals_list.js b/pages/user/withdrawals_list/withdrawals_list.js deleted file mode 100644 index 940598d..0000000 --- a/pages/user/withdrawals_list/withdrawals_list.js +++ /dev/null @@ -1,31 +0,0 @@ -var t = function(t) { - return t && t.__esModule ? t : { - default: t - }; -}(require("../../../utils/LoadMore.js")), a = getApp(), e = new t.default(), r = require("../../../utils/util.js"); - -Page({ - data: { - url: a.globalData.setting.url, - resourceUrl: a.globalData.setting.resourceUrl, - withdrawals: null, - currentPage: 1 - }, - onLoad: function() { - e.init(this, "", "withdrawals"), this.requestWithdrawalsList(); - }, - requestWithdrawalsList: function() { - var t = this, a = "/api/user/withdrawals_list/?p=" + t.data.currentPage; - e.request(a, function(a) { - t.data.currentPage++, a.data.result.forEach(function(t, a, e) { - t.createTimeFommat = r.format(t.create_time, "yyyy-MM-dd"); - }), wx.stopPullDownRefresh(); - }); - }, - onReachBottom: function() { - e.canloadMore() && this.requestWithdrawalsList(); - }, - onPullDownRefresh: function() { - this.data.withdrawals = null, this.data.currentPage = 1, e.resetConfig(), this.requestWithdrawalsList(); - } -}); \ No newline at end of file diff --git a/pages/user/withdrawals_list/withdrawals_list.json b/pages/user/withdrawals_list/withdrawals_list.json deleted file mode 100644 index bece1ed..0000000 --- a/pages/user/withdrawals_list/withdrawals_list.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "navigationBarTitleText": "提现申请记录" -} \ No newline at end of file diff --git a/pages/user/withdrawals_list/withdrawals_list.wxml b/pages/user/withdrawals_list/withdrawals_list.wxml deleted file mode 100644 index 805d0ec..0000000 --- a/pages/user/withdrawals_list/withdrawals_list.wxml +++ /dev/null @@ -1,14 +0,0 @@ - - - 编号 - 申请日期 - 金额 - 状态 - - - {{item.id}} - {{item.createTimeFommat}} - {{item.money}} - {{item.status==0?'申请中':''}}{{item.status==1?'申请成功':''}}{{item.status==2?'申请失败':''}} - - diff --git a/pages/user/withdrawals_list/withdrawals_list.wxss b/pages/user/withdrawals_list/withdrawals_list.wxss deleted file mode 100644 index 652c284..0000000 --- a/pages/user/withdrawals_list/withdrawals_list.wxss +++ /dev/null @@ -1,42 +0,0 @@ -page { - background-color: white; -} - -.withdrawal-box { - font-size: 28rpx; - padding: 25rpx 30rpx; - border-bottom: 1rpx solid #f8f8f8; -} - -.withdrawal-item { - display: inline-block; - word-break: keep-all; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - color: #666666; - box-sizing: border-box; - text-align: center; -} - -.withdrawal-box .pay { - width: 20%; -} - -.withdrawal-box .time { - width: 27%; -} - -.withdrawal-box .price { - width: 28%; -} - -.withdrawal-box .status { - width: 25%; - color: #e01222; -} - -.withdrawal-box .title { - color: #666666; - font-size: 32rpx; -} \ No newline at end of file diff --git a/utils/filter.wxs b/utils/filter.wxs index 83bdcfa..52cd24a 100644 --- a/utils/filter.wxs +++ b/utils/filter.wxs @@ -82,24 +82,7 @@ var filters = { } }, - - // show_default: function (value, placeholder, multiple) { - // if(typeof value === 'number') { - // if(isNaN(value) || value === 0) { - // return placeholder || '0'; - // } else { - // if(multiple) { - // return value / multiple; - // } else { - // return value; - // } - // }; - // } else if(value === '' || value === undefined || value === null) { - // return placeholder || '-'; - // } else { - // return value; - // } - // }, + show_default: function (value, placeholder, multiple) { if(typeof value === 'number') { if(isNaN(value)) {