Commit 5f235574951d2cf9e9916e1d7efdb1a058392429

Authored by 后端研发-苏泰源
2 parents b18eec83 52c84b32

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

# Conflicts:
#	packageA/pages/goodsInfo/goodsInfo.js
1 1 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");
2   -var os=t;
  2 +var os = t;
3 3 var regeneratorRuntime = require('./utils/runtime.js');
4 4 var api = require("./api/api.js")
5   -
  5 +// import { pluginGD } from './utils/ai_config/config'
6 6 //公共方法和变量
7 7 App({
8 8  
9   - def_list:[
10   - {
11   - "weappurl": "pages/index/index/index",
12   - "nav_name": "首页",
13   - "src": t.imghost+"/miniapp/images/bar/index.png",
14   - "src_sele": t.imghost+"/miniapp/images/bar/index_on.png",
15   - },
16   - {
17   - "weappurl": "pages/goods/categoryList/categoryList",
18   - "nav_name": "分类",
19   - "src": t.imghost+"/miniapp/images/bar/fl.png",
20   - "src_sele": t.imghost+"/miniapp/images/bar/fl_on.png"
21   - },
22   - {
23   - "weappurl": "pages/distribution/distribution",
24   - "nav_name": "分销",
25   - "src": t.imghost+"/miniapp/images/bar/fx.png",
26   - "src_sele": t.imghost+"/miniapp/images/bar/fx_on.png"
27   - },
28   - {
29   - "weappurl": "pages/cart/cart/cart",
30   - "nav_name": "购物车",
31   - "src": t.imghost+"/miniapp/images/bar/car.png",
32   - "src_sele": t.imghost+"/miniapp/images/bar/car_on.png"
33   - },
34   - {
35   - "weappurl": "pages/user/index/index",
36   - "nav_name": "我的",
37   - "src": t.imghost+"/miniapp/images/bar/user.png",
38   - "src_sele": t.imghost+"/miniapp/images/bar/user_on.png"
39   - }
40   - ],
41   -
42   - globalData: {
43   - cartGoodsNum:0, //购物车总数量
44   - isTabBar :false,
45   - isIpx: false, //适配IPhoneX
46   - url:"",
47   - setting: t,
48   - wechatUser: null,
49   - userInfo: null,
50   - config: null, //门店参数
51   - config2: null, //门店配置
52   - code: null,
53   - user_id:null,//1564704,// 10153869,// 6453964,//5682094,
54   - buy_now:null,
55   - picklist:null, //门店列表
56   - wuliuprice: null, //物流价格表
57   - wuliu: null, //物流公司
58   - baddr:null,
59   - mobile: null, //记录手机
60   - getu:null, //记录会员信息
61   - sessionKey: null,//记录会员信息
62   - openid: null, //记录会员信息
63   -
64   - to_group:null, //参团传递的数据
65   - wxapp_buy_obj:null, //微信小程序购买的Object
66   - pk_store:null, //选择的门店
67   - first_leader:null, //分享会员ID
68   - guide_id:null, //分享导购ID
69   -
70   - windowWidth:0, //整个窗体的宽度
71   -
72   - room_id:null, //直播间分享的房间ID
73   - room_goods_id:null, //直播间分享的商品ID
74   -
75   - },
  9 + def_list: [
  10 + {
  11 + "weappurl": "pages/index/index/index",
  12 + "nav_name": "首页",
  13 + "src": t.imghost + "/miniapp/images/bar/index.png",
  14 + "src_sele": t.imghost + "/miniapp/images/bar/index_on.png",
  15 + },
  16 + {
  17 + "weappurl": "pages/goods/categoryList/categoryList",
  18 + "nav_name": "分类",
  19 + "src": t.imghost + "/miniapp/images/bar/fl.png",
  20 + "src_sele": t.imghost + "/miniapp/images/bar/fl_on.png"
  21 + },
  22 + {
  23 + "weappurl": "pages/distribution/distribution",
  24 + "nav_name": "分销",
  25 + "src": t.imghost + "/miniapp/images/bar/fx.png",
  26 + "src_sele": t.imghost + "/miniapp/images/bar/fx_on.png"
  27 + },
  28 + {
  29 + "weappurl": "pages/cart/cart/cart",
  30 + "nav_name": "购物车",
  31 + "src": t.imghost + "/miniapp/images/bar/car.png",
  32 + "src_sele": t.imghost + "/miniapp/images/bar/car_on.png"
  33 + },
  34 + {
  35 + "weappurl": "pages/user/index/index",
  36 + "nav_name": "我的",
  37 + "src": t.imghost + "/miniapp/images/bar/user.png",
  38 + "src_sele": t.imghost + "/miniapp/images/bar/user_on.png"
  39 + }
  40 + ],
  41 +
  42 +
  43 + globalData: {
  44 + cartGoodsNum: 0, //购物车总数量
  45 + isTabBar: false,
  46 + isIpx: false, //适配IPhoneX
  47 + url: "",
  48 + setting: t,
  49 + wechatUser: null,
  50 + userInfo: null,
  51 + config: null, //门店参数
  52 + config2: null, //门店配置
  53 + code: null,
  54 + user_id: 5682094,//1564704,// 10153869,// 6453964,//5682094,6520044,6520119 qa 4687 6519901
  55 + buy_now: null,
  56 + picklist: null, //门店列表
  57 + wuliuprice: null, //物流价格表
  58 + wuliu: null, //物流公司
  59 + baddr: null,
  60 + mobile: null, //记录手机
  61 + getu: null, //记录会员信息
  62 + sessionKey: null,//记录会员信息
  63 + openid: null, //记录会员信息
  64 +
  65 + to_group: null, //参团传递的数据
  66 + wxapp_buy_obj: null, //微信小程序购买的Object
  67 + pk_store: null, //选择的门店
  68 + first_leader: null, //分享会员ID
  69 + guide_id: null, //分享导购ID
  70 + windowWidth: 0, //整个窗体的宽度
  71 + room_id: null, //直播间分享的房间ID
  72 + room_goods_id: null, //直播间分享的商品ID
  73 +
  74 + },
76 75 auth: o,
77 76 request: a,
78   - onLaunch: function() {
79   - wx.hideTabBar();
  77 + onLaunch: function () {
  78 + //初始化美图测肤插件
  79 + // var plugin = requirePlugin('mtSkinSdk');
  80 + // params.login_id = wx.getStorageSync('login_id') || '' // 可将登录id缓存下来,方便下次进入小程序直接获取
  81 + // plugin.setConfig(pluginGD)
  82 +
  83 + wx.hideTabBar();
80 84 this.initExt();
81 85  
82 86 //检查更新
... ... @@ -88,52 +92,52 @@ App({
88 92 var clientWidth = wx.getSystemInfoSync().windowWidth;
89 93 var rpxR = 750 / clientWidth;
90 94 var calc = wx.getSystemInfoSync().windowHeight * rpxR;
91   - this.globalData.heigth=calc;
92   - this.globalData.windowWidth=clientWidth;
  95 + this.globalData.heigth = calc;
  96 + this.globalData.windowWidth = clientWidth;
93 97  
94   - var app=this;
95   - if(!app.globalData.userInfo){
  98 + var app = this;
  99 + if (!app.globalData.userInfo) {
96 100 var user = wx.getStorageSync("userinfo");
97   - if (user && user.user_id){
98   - //--生成会员 --
99   - app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id,{}).then(res=>{
100   - if(res.data.code==0){
101   - user=res.data.data;
102   - //-- 小程序会员被解绑了,就要清空会员 --
103   - if(user['is_weappuser']==0){
104   - user=null;
105   - app.globalData.userInfo=null;
106   - app.globalData.user_id= 0;
107   - }else{
108   - app.globalData.userInfo=user;
109   - app.globalData.user_id= user.user_id;
110   - }
111   - wx.setStorageSync("userinfo",user);
112   - }else{
113   - user=null;
114   - app.globalData.userInfo=null;
115   - app.globalData.user_id= 0;
116   - wx.setStorageSync("userinfo",null);
117   - }
118   - })
  101 + if (user && user.user_id) {
  102 + //--生成会员 --
  103 + app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id, {}).then(res => {
  104 + if (res.data.code == 0) {
  105 + user = res.data.data;
  106 + //-- 小程序会员被解绑了,就要清空会员 --
  107 + if (user['is_weappuser'] == 0) {
  108 + user = null;
  109 + app.globalData.userInfo = null;
  110 + app.globalData.user_id = 0;
  111 + } else {
  112 + app.globalData.userInfo = user;
  113 + app.globalData.user_id = user.user_id;
  114 + }
  115 + wx.setStorageSync("userinfo", user);
  116 + } else {
  117 + user = null;
  118 + app.globalData.userInfo = null;
  119 + app.globalData.user_id = 0;
  120 + wx.setStorageSync("userinfo", null);
  121 + }
  122 + })
119 123 }
120 124 }
121 125 wx.getSystemInfo({
122   - success: (res) => {
123   - // console.log(res)
124   - let modelmes = res?res.model:null; //手机品牌
125   - console.log('手机品牌', modelmes)
126   - if (modelmes && modelmes.indexOf('iPhone X') != -1) {  //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来
127   - this.globalData.isIpx = true
128   - }
129   - },
  126 + success: (res) => {
  127 + // console.log(res)
  128 + let modelmes = res ? res.model : null; //手机品牌
  129 + console.log('手机品牌', modelmes)
  130 + if (modelmes && modelmes.indexOf('iPhone X') != -1) {  //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来
  131 + this.globalData.isIpx = true
  132 + }
  133 + },
130 134 })
131 135  
132   - var th=this;
  136 + var th = this;
133 137 var pages = getCurrentPages(); //获取加载的页面
134 138 var currentPage = pages[pages.length - 1]; //获取当前页面的对象
135 139  
136   - if(!th.globalData.wxapp_buy_obj) {
  140 + if (!th.globalData.wxapp_buy_obj) {
137 141 var turl = "/api/weshop/storeconfig/get/" + th.globalData.setting.stoid;
138 142 th.promiseGet(turl, {}).then(res => {
139 143 var o = res;
... ... @@ -176,7 +180,7 @@ App({
176 180 })
177 181  
178 182 }
179   - else{
  183 + else {
180 184 var tt = th.globalData.wxapp_buy_obj;
181 185 if (tt && tt.isout == 1) {
182 186 th.promiseGet('/api/weshop/store/get/' + t.stoid, {}).then(res => {
... ... @@ -202,394 +206,408 @@ App({
202 206 },
203 207  
204 208 //---初始化第三方----
205   - initExt: function() {
206   - var tt=t;
  209 + initExt: function () {
  210 + var tt = t;
207 211 console.log("initExt");
208 212 console.log(11);
209 213 var t = wx.getExtConfigSync(), o = this.globalData.setting;
210 214 console.log(t);
211   - t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt=1;
  215 + t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt = 1;
212 216  
213 217 },
214 218  
215 219 //首页的第一次登录
216   - getUserFir(t){
217   - var s = this;
218   - if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else {
219   - if (!o.isAuth()) return o.wxLogin_fir(t);
220   - if (null == s.globalData.userInfo) {
221   - return o.wxLogin_fir(t);
  220 + getUserFir(t) {
  221 + var s = this;
  222 + if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else {
  223 + if (!o.isAuth()) return o.wxLogin_fir(t);
  224 + if (null == s.globalData.userInfo) {
  225 + return o.wxLogin_fir(t);
  226 + }
222 227 }
223   - }
224 228 },
225 229  
226   - getUserInfo: function(t, n, i) {
  230 + getUserInfo: function (t, n, i) {
227 231 var s = this;
228 232 if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else {
229   - if (!o.isAuth()) return o.auth(t);
230   - if (null == s.globalData.userInfo){
231   - return o.auth(t);
232   - }
233   - /*---
234   - a.get("/api/user/userInfo", {
235   - isShowLoading: void 0 === i || i,
236   - success: function(o) {
237   - s.globalData.userInfo = o.data.result, s.globalData.userInfo.head_pic = e.getFullUrl(s.globalData.userInfo.head_pic),
238   - "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser);
239   - }
240   - });--*/
  233 + if (!o.isAuth()) return o.auth(t);
  234 + if (null == s.globalData.userInfo) {
  235 + return o.auth(t);
  236 + }
  237 + /*---
  238 + a.get("/api/user/userInfo", {
  239 + isShowLoading: void 0 === i || i,
  240 + success: function(o) {
  241 + s.globalData.userInfo = o.data.result, s.globalData.userInfo.head_pic = e.getFullUrl(s.globalData.userInfo.head_pic),
  242 + "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser);
  243 + }
  244 + });--*/
241 245 }
242 246 },
243 247 //----------------获取配置参数--------------------
244   - getConfig: function(t, o) {
245   - var e = this;
246   - if(!e.globalData.setting.stoid){
247   - t(null);
248   - return false;
249   - }
250   - if(this.globalData.config==undefined) this.globalData.config=null;
251   - this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.requestGet("/api/weshop/store/get/" + e.globalData.setting.stoid, {
252   - success: function(o) {
253   - console.log('getConfig');
254   - if(o.data.code==0){
  248 + getConfig: function (t, o) {
  249 + var e = this;
  250 + if (!e.globalData.setting.stoid) {
  251 + t(null);
  252 + return false;
  253 + }
  254 + if (this.globalData.config == undefined) this.globalData.config = null;
  255 + this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.requestGet("/api/weshop/store/get/" + e.globalData.setting.stoid, {
  256 + success: function (o) {
  257 + console.log('getConfig', o);
  258 + if (o.data.code == 0) {
255 259 e.globalData.config = o.data.data, "function" == typeof t && t(e.globalData.config);
256 260 }
257 261 }
258 262 });
259 263 },
260 264 //----------------获取配置参数--------------------
261   - getConfig2: function (t, o) {
262   - var e = this;
263   - if(!e.globalData.setting.stoid) {
264   - t(null);
265   - return false;
266   - }
267   - this.globalData.config2 && !o ?
268   - "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, {
269   - success: function (o) {
270   - console.log('getConfig2');
271   - if (o.data.code == 0) {
272   - e.globalData.config2 = o.data.data, "function" == typeof t && t(e.globalData.config2);
273   - }
274   - }
275   - });
276   - },
277   -
278   - //----------------获取商家开启的物流--------------------
279   - getwuliu: function (t, o){
280   - this.globalData.wuliu=null;
281   - var th = this, st = this.globalData.setting;
282   - //获取物流不缓存
283   - a.get("/api/weshop/storeshipping/list", {
284   - data: { store_id: st.stoid, status: 1, pageSize:2000 },
285   - success: function (o) {
286   - console.log('getwuliu');
287   - console.log(o);
288   - if (o.data.code == 0 && o.data.data && o.data.data.pageData && o.data.data.pageData.length>0) {
289   - var arr = o.data.data.pageData;
290   - console.log(arr);
291   - arr.forEach(function(item,index){
292   - arr[index].code = item.shipping_code; arr[index].name = item.shipping_name;
293   - })
294   - th.globalData.wuliu = arr, "function" == typeof t && t(arr);
295   - }
296   - }
297   - });
298   - },
299   -
300   - //----------------获取物流价格表--------------------
301   - getwuliuprice: function (t, o) {
302   - var e = this,th=e, st = this.globalData.setting;
303   - //获取物流不缓存
304   - a.get("/api/weshop/shippingarea/list",{
305   - data: { store_id: st.stoid,pageSize: 2000 },
306   - success: function (o) {
307   - console.log('getwuliuprice');
308   - console.log(o);
309   - if (o.data.code == 0) {
310   - var arr=o.data.data.pageData;
311   - console.log(arr);
312   - if (arr.length>0){
313   - for (var i = 0; i < arr.length;i++){
314   - arr[i].code = arr[i].shipping_code;
315   - if (arr[i].json_config != "" && arr[i].json_config != undefined && arr[i].json_config != null )
316   - arr[i].config = JSON.parse(arr[i].json_config);
317   - }
318   - }
319   - th.globalData.wuliuprice = o.data.data, "function" == typeof t && t(e.globalData.wuliuprice);
320   - }
  265 + getConfig2: function (t, o) {
  266 + var e = this;
  267 + if (!e.globalData.setting.stoid) {
  268 + t(null);
  269 + return false;
321 270 }
322   - });
323   - },
  271 + this.globalData.config2 && !o ?
  272 + "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, {
  273 + success: function (o) {
  274 + console.log('getConfig2');
  275 + if (o.data.code == 0) {
  276 + e.globalData.config2 = o.data.data, "function" == typeof t && t(e.globalData.config2);
  277 + }
  278 + }
  279 + });
  280 + },
  281 +
  282 + //----------------获取商家开启的物流--------------------
  283 + getwuliu: function (t, o) {
  284 + this.globalData.wuliu = null;
  285 + var th = this, st = this.globalData.setting;
  286 + //获取物流不缓存
  287 + a.get("/api/weshop/storeshipping/list", {
  288 + data: { store_id: st.stoid, status: 1, pageSize: 2000 },
  289 + success: function (o) {
  290 + console.log('getwuliu');
  291 + console.log(o);
  292 + if (o.data.code == 0 && o.data.data && o.data.data.pageData && o.data.data.pageData.length > 0) {
  293 + var arr = o.data.data.pageData;
  294 + console.log(arr);
  295 + arr.forEach(function (item, index) {
  296 + arr[index].code = item.shipping_code; arr[index].name = item.shipping_name;
  297 + })
  298 + th.globalData.wuliu = arr, "function" == typeof t && t(arr);
  299 + }
  300 + }
  301 + });
  302 + },
  303 +
  304 + //----------------获取物流价格表--------------------
  305 + getwuliuprice: function (t, o) {
  306 + var e = this, th = e, st = this.globalData.setting;
  307 + //获取物流不缓存
  308 + a.get("/api/weshop/shippingarea/list", {
  309 + data: { store_id: st.stoid, pageSize: 2000 },
  310 + success: function (o) {
  311 + console.log('getwuliuprice');
  312 + console.log(o);
  313 + if (o.data.code == 0) {
  314 + var arr = o.data.data.pageData;
  315 + console.log(arr);
  316 + if (arr.length > 0) {
  317 + for (var i = 0; i < arr.length; i++) {
  318 + arr[i].code = arr[i].shipping_code;
  319 + if (arr[i].json_config != "" && arr[i].json_config != undefined && arr[i].json_config != null)
  320 + arr[i].config = JSON.parse(arr[i].json_config);
  321 + }
  322 + }
  323 + th.globalData.wuliuprice = o.data.data, "function" == typeof t && t(e.globalData.wuliuprice);
  324 + }
  325 + }
  326 + });
  327 + },
324 328 //----------------设置立即购买数组--------------------
325   - set_b_now: function (d) { this.globalData.buy_now=d;},
326   - get_b_now: function () {return this.globalData.buy_now},
  329 + set_b_now: function (d) { this.globalData.buy_now = d; },
  330 + get_b_now: function () { return this.globalData.buy_now },
327 331  
328   - getPrevPageData: function(t) {
  332 + getPrevPageData: function (t) {
329 333 void 0 === t && (t = 1);
330 334 var o = getCurrentPages();
331 335 return o[o.length - t - 1].data;
332 336 },
333   - showLoading: function(t, o) {
  337 + showLoading: function (t, o) {
334 338 void 0 === o && (o = 1500), wx.showToast({
335 339 title: "加载中",
336 340 icon: "loading",
337 341 duration: o,
338 342 mask: !0,
339   - complete: function() {
  343 + complete: function () {
340 344 "function" == typeof t && setTimeout(t, o);
341 345 }
342 346 });
343 347 },
344   - showSuccess: function(t, o, a) {
  348 + showSuccess: function (t, o, a) {
345 349 void 0 === a && (a = 1e3), wx.showToast({
346 350 title: t,
347 351 icon: "success",
348 352 duration: a,
349 353 mask: !0,
350   - complete: function() {
  354 + complete: function () {
351 355 "function" == typeof o && setTimeout(o, a);
352 356 }
353 357 });
354 358 },
355   - showWarning: function(t, o, a, e) {
  359 + showWarning: function (t, o, a, e) {
356 360 //var imghost=this.globalData.setting.imghost;
357 361 !a && (a = 1500), void 0 === e && (e = !0), wx.showToast({
358 362 title: t,
359 363 mask: e,
360 364 duration: a,
361   - image:"/images/gt.png",
362   - complete: function() {
  365 + image: "/images/gt.png",
  366 + complete: function () {
363 367 "function" == typeof o && setTimeout(o, a);
364 368 }
365 369 });
366 370 },
367 371  
368   - confirmBox: function(t, o) {
  372 + confirmBox: function (t, o) {
369 373 wx.showModal({
370 374 title: t,
371 375 showCancel: !1,
372   - complete: function() {
  376 + complete: function () {
373 377 "function" == typeof o && o();
374 378 }
375 379 });
376 380 },
377 381  
378 382 //----------获取所有的门店------------
379   - get_allsto(func){
380   - var th=this;
381   - if (this.globalData.picklist!=null){
382   - "function" == typeof func && func(th.globalData.picklist);
383   - }else{
384   - th.request.get("/api/weshop/pickup/page", {
385   - data: { store_id: th.globalData.setting.stoid, pageSize: 600 },
386   - success: function (da) {
387   - //设置门店
388   - //th.setData({ allsto: da.data.data.pageData });
389   - th.globalData.picklist = da.data.data.pageData;
390   - "function" == typeof func && func(th.globalData.picklist);
391   - }
392   - })
  383 + get_allsto(func) {
  384 + var th = this;
  385 + if (this.globalData.picklist != null) {
  386 + "function" == typeof func && func(th.globalData.picklist);
  387 + } else {
  388 + th.request.get("/api/weshop/pickup/page", {
  389 + data: { store_id: th.globalData.setting.stoid, pageSize: 600 },
  390 + success: function (da) {
  391 + //设置门店
  392 + //th.setData({ allsto: da.data.data.pageData });
  393 + th.globalData.picklist = da.data.data.pageData;
  394 + "function" == typeof func && func(th.globalData.picklist);
  395 + }
  396 + })
393 397 }
394 398 },
395 399  
396 400 //同步化,在调用的时候要await
397   - async get_isbuy(func) {
398   - var th=this
399   - var stoid=os.stoid;
400   -
401   - await this.promiseGet("/store/storemoduleendtime/page?store_id=" +stoid + "&type=5",{}).then(res=>{
402   - var o=res;
403   - if (o.data.code == 0) {
404   - var ob = { isout: 0, isbuy: 1 };
405   - var arr = o.data.data.pageData;
406   - var isbuy = 0;
407   - //----如果数组不为空----
408   - if (arr.length > 0) {
409   - arr.forEach(function (val, ind) {
410   - if (val.is_sy == 0 && val.type == 5) {
411   - isbuy = 1;
412   - var now = ut.gettimestamp();
413   - if (now > val.end_time) ob.isout = 1;
414   - return false;
415   - }
  401 + async get_isbuy(func) {
  402 + var th = this
  403 + var stoid = os.stoid;
  404 +
  405 + await this.promiseGet("/store/storemoduleendtime/page?store_id=" + stoid + "&type=5", {}).then(res => {
  406 + var o = res;
  407 + if (o.data.code == 0) {
  408 + var ob = { isout: 0, isbuy: 1 };
  409 + var arr = o.data.data.pageData;
  410 + var isbuy = 0;
  411 + //----如果数组不为空----
  412 + if (arr.length > 0) {
  413 + arr.forEach(function (val, ind) {
  414 + if (val.is_sy == 0 && val.type == 5) {
  415 + isbuy = 1;
  416 + var now = ut.gettimestamp();
  417 + if (now > val.end_time) ob.isout = 1;
  418 + return false;
  419 + }
  420 + })
  421 + }
  422 + ob.isbuy = isbuy;
  423 + th.globalData.wxapp_buy_obj = ob;
  424 + if (func) {
  425 + func();
  426 + }
  427 + }
  428 + })
  429 + },
  430 + //获取场景值 判断是否是单页面
  431 + is_Single_page() {
  432 + let scene = wx.getLaunchOptionsSync().scene;
  433 + //--先判断会员状态--
  434 + if (scene == 1154) {
  435 + wx.showToast({
  436 + title: '请前往小程序',
  437 + icon: "error",
  438 + duration: 3000,
416 439 })
417   - }
418   - ob.isbuy = isbuy;
419   - th.globalData.wxapp_buy_obj=ob;
420   - if(func){
421   - func();
422   - }
  440 + return false
423 441 }
424   - })
  442 + return true;
425 443 },
426 444  
  445 +
427 446 //--同步化,在调用的时候要await,获取商家config--
428   - async getConfig_ays(){
429   - if(this.globalData.config!=null) return false;
430   - var th=this;
431   - await api.get_config(this.globalData.setting.stoid).then(res=>{
432   - var o=res;
433   - if(o.data.code==0){
434   - th.globalData.config = o.data.data;
435   - }
436   - })
  447 + async getConfig_ays() {
  448 + if (this.globalData.config != null) return false;
  449 + var th = this;
  450 + await api.get_config(this.globalData.setting.stoid).then(res => {
  451 + var o = res;
  452 + if (o.data.code == 0) {
  453 + th.globalData.config = o.data.data;
  454 + }
  455 + })
437 456 },
438 457  
439 458 //----智能跳转,判断 非tabBar,tabBar页面的跳转----
440   - goto:function (url) {
441   - var arr=getCurrentPages();
442   - if(arr.length>8){
443   - arr.splice(0, 2);
444   - }
445   - var arr_tabbar=["/pages/index/index/index",
446   - "/pages/goods/categoryList/categoryList",
447   - "/pages/goods/categoryList/categoryList?type=2",
448   - "/pages/goods/categoryList/categoryList?type=1",
449   - "/pages/cart/cart/cart","/pages/user/index/index",
450   - "/pages/distribution/distribution"];
451   - if(arr_tabbar.indexOf(url)!=-1){
452   - if(url.indexOf("categoryList?type=1")!=-1) this.globalData.cat_type=1;
453   - if(url.indexOf("categoryList?type=2")!=-1) this.globalData.cat_type=2;
454   - wx.switchTab({url: url,}) //跳到tabbar页
455   -
456   - }else{
  459 + goto: function (url) {
  460 + var arr = getCurrentPages();
  461 + if (arr.length > 8) {
  462 + arr.splice(0, 2);
  463 + }
  464 + var arr_tabbar = ["/pages/index/index/index",
  465 + "/pages/goods/categoryList/categoryList",
  466 + "/pages/goods/categoryList/categoryList?type=2",
  467 + "/pages/goods/categoryList/categoryList?type=1",
  468 + "/pages/cart/cart/cart", "/pages/user/index/index",
  469 + "/pages/distribution/distribution"];
  470 + if (arr_tabbar.indexOf(url) != -1) {
  471 + if (url.indexOf("categoryList?type=1") != -1) this.globalData.cat_type = 1;
  472 + if (url.indexOf("categoryList?type=2") != -1) this.globalData.cat_type = 2;
  473 + wx.switchTab({ url: url, }) //跳到tabbar页
  474 +
  475 + } else {
457 476 if (getCurrentPages().length > 9) {
458   - wx.redirectTo({url: url,}) //跳到非tabbar页
459   - }else{
460   - wx.navigateTo({url: url,}) //跳到tabbar页
  477 + wx.redirectTo({ url: url, }) //跳到非tabbar页
  478 + } else {
  479 + wx.navigateTo({ url: url, }) //跳到tabbar页
461 480 }
462 481 }
463 482 //wx.navigateTo({ url: url, }) //跳到非tabbar页
464 483 },
465 484  
466 485 //显示提示,word提示内容,type 0失败,提示 1成功
467   - my_warnning(word,type,that,width){
  486 + my_warnning(word, type, that, width) {
468 487 var warn = that.selectComponent("#warn"); //组件的id
469   - warn.open(word,type,width);
  488 + warn.open(word, type, width);
470 489 return 1;
471 490 },
472 491  
473 492 //获取会员门店
474   - get_user_store:function (func)
475   - {
476   - var th=this;
  493 + get_user_store: function (func) {
  494 + var th = this;
477 495 this.getConfig2(function (conf) {
478 496 //---空会员的情况---
479   - if(!th.globalData.userInfo){
  497 + if (!th.globalData.userInfo) {
480 498 return func(null);
481 499 }
482   - if(!th.globalData.pk_store){
483   - var pick_id=0;
  500 + if (!th.globalData.pk_store) {
  501 + var pick_id = 0;
484 502 //先找一个会员是否有设置默认的地址
485   - if(th.globalData.userInfo.def_pickup_id){
486   - pick_id= th.globalData.userInfo.def_pickup_id
  503 + if (th.globalData.userInfo.def_pickup_id) {
  504 + pick_id = th.globalData.userInfo.def_pickup_id
487 505 }
488 506 //查找会员的注册的地址
489   - else if(th.globalData.userInfo.pickup_id){
  507 + else if (th.globalData.userInfo.pickup_id) {
490 508 //--购买门店是否默认登记门店--
491   - if(conf.switch_list){
492   - var t_swi=JSON.parse(conf.switch_list);
493   - if(t_swi.is_regstores){
494   - pick_id= th.globalData.userInfo.pickup_id
  509 + if (conf.switch_list) {
  510 + var t_swi = JSON.parse(conf.switch_list);
  511 + if (t_swi.is_regstores) {
  512 + pick_id = th.globalData.userInfo.pickup_id
495 513 }
496 514 }
497 515  
498 516 }
499 517 //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店--
500   - if(pick_id==0) return func(null);
501   -
502   - //返回门店的数量
503   - th.get_pk_num(function(num){
504   - //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭
505   - th.request.get("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{
506   - data:{},
507   - success:function (res) {
508   - th.globalData.pk_store=null;
509   - if(res.data.code==0 && res.data.data && res.data.data.isstop==0 && res.data.data.is_pos==1){
510   -
511   - //--门店的数量大于10个才要关心门店的分类有没有关闭--
512   - if(res.data.data.category_id && num>10){
513   - th.request.get( "/api/weshop/storagecategory/get/"+os.stoid+"/"+res.data.data.category_id, {
514   - data: {},
515   - success: function (ee) {
516   - if(ee.data.code==0 && ee.data.data ){
517   - if(ee.data.data.is_show==1){
518   - th.globalData.pk_store = res.data.data;
519   - func(th.globalData.pk_store);
520   - }else{
521   - //看一下有没有显示的门店分类
522   - getApp().request.get("/api/weshop/storagecategory/page", {
523   - data: {
524   - store_id: os.stoid,
525   - is_show: 1,
526   - pageSize: 1,
527   - },
528   - success: function (ee) {
529   - if(ee.data.code==0){
530   - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){
531   - func(null);
532   - }else{
533   - th.globalData.pk_store = res.data.data;
534   - func(th.globalData.pk_store);
535   - }
536   - }else{
537   - th.globalData.pk_store = res.data.data;
538   - func(th.globalData.pk_store);
539   - }
540   - }
541   - })
542   - }
543   - }else{
  518 + if (pick_id == 0) return func(null);
  519 +
  520 + //返回门店的数量
  521 + th.get_pk_num(function (num) {
  522 + //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭
  523 + th.request.get("/api/weshop/pickup/get/" + os.stoid + "/" + pick_id, {
  524 + data: {},
  525 + success: function (res) {
  526 + th.globalData.pk_store = null;
  527 + if (res.data.code == 0 && res.data.data && res.data.data.isstop == 0 && res.data.data.is_pos == 1) {
  528 +
  529 + //--门店的数量大于10个才要关心门店的分类有没有关闭--
  530 + if (res.data.data.category_id && num > 10) {
  531 + th.request.get("/api/weshop/storagecategory/get/" + os.stoid + "/" + res.data.data.category_id, {
  532 + data: {},
  533 + success: function (ee) {
  534 + if (ee.data.code == 0 && ee.data.data) {
  535 + if (ee.data.data.is_show == 1) {
  536 + th.globalData.pk_store = res.data.data;
  537 + func(th.globalData.pk_store);
  538 + } else {
  539 + //看一下有没有显示的门店分类
  540 + getApp().request.get("/api/weshop/storagecategory/page", {
  541 + data: {
  542 + store_id: os.stoid,
  543 + is_show: 1,
  544 + pageSize: 1,
  545 + },
  546 + success: function (ee) {
  547 + if (ee.data.code == 0) {
  548 + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
  549 + func(null);
  550 + } else {
  551 + th.globalData.pk_store = res.data.data;
  552 + func(th.globalData.pk_store);
  553 + }
  554 + } else {
  555 + th.globalData.pk_store = res.data.data;
  556 + func(th.globalData.pk_store);
  557 + }
  558 + }
  559 + })
  560 + }
  561 + } else {
544 562 func(null);
545   - }
546   - }
547   - })
548   - }else{
549   - th.globalData.pk_store = res.data.data;
550   - func(th.globalData.pk_store);
551   - }
552   - }else{
553   - func(null);
554   - }
555   - }
556   - })
557   -
558   - })
559   -
560   - }else{
  563 + }
  564 + }
  565 + })
  566 + } else {
  567 + th.globalData.pk_store = res.data.data;
  568 + func(th.globalData.pk_store);
  569 + }
  570 + } else {
  571 + func(null);
  572 + }
  573 + }
  574 + })
  575 +
  576 + })
  577 +
  578 + } else {
561 579 func(th.globalData.pk_store);
562 580 }
563 581 })
564 582 },
565   -
566   - //-- 获取门店的数量 --
567   - get_pk_num:function(func){
568   - this.request.get("/api/weshop/pickup/page",{
569   - data:{page:1,pageSize:1,isstop:0,store_id:os.stoid},
570   - success:function (res) {
571   - if(res.data.code==0){
572   - func(res.data.data.total); //门店数量
573   - }
574   - }
575   - });
576   - },
  583 +
  584 + //-- 获取门店的数量 --
  585 + get_pk_num: function (func) {
  586 + this.request.get("/api/weshop/pickup/page", {
  587 + data: { page: 1, pageSize: 1, isstop: 0, store_id: os.stoid },
  588 + success: function (res) {
  589 + if (res.data.code == 0) {
  590 + func(res.data.data.total); //门店数量
  591 + }
  592 + }
  593 + });
  594 + },
577 595 //-------获取购物车数量----------
578   - requestCardNum: function(th) {
579   - if(!this.globalData.user_id) return false;
580   - var that=this;
  596 + requestCardNum: function (th) {
  597 + if (!this.globalData.user_id) return false;
  598 + var that = this;
581 599 this.request.get("/api/weshop/cart/page", {
582   - isShoeLoading:false,
  600 + isShoeLoading: false,
583 601 data: {
584 602 store_id: this.globalData.setting.stoid,
585 603 user_id: this.globalData.user_id,
586   - state:0,
587   - is_gift:0,
588   - pageSize:300
  604 + state: 0,
  605 + is_gift: 0,
  606 + pageSize: 300
589 607 },
590   - success: function(e) {
  608 + success: function (e) {
591 609 var num = 0;
592   - if(e.data.data && e.data.data.pageData) {
  610 + if (e.data.data && e.data.data.pageData) {
593 611 for (var i = 0; i < e.data.data.pageData.length; i++) {
594 612 num += e.data.data.pageData[i].goods_num;
595 613 }
... ... @@ -600,131 +618,131 @@ App({
600 618 text: '' + num //显示的内容
601 619 });--*/
602 620 //-- 读取服务卡的数量 --
603   - that.promiseGet("/api/weshop/cartService/page",{
604   - data:{
  621 + that.promiseGet("/api/weshop/cartService/page", {
  622 + data: {
605 623 store_id: that.globalData.setting.stoid,
606 624 user_id: that.globalData.user_id,
607 625 }
608   - }).then(res=>{
  626 + }).then(res => {
609 627  
610 628 for (var i = 0; i < res.data.data.pageData.length; i++) {
611 629 num += res.data.data.pageData[i].goods_num;
612 630 }
613 631  
614   - that.globalData.cartGoodsNum=num;
  632 + that.globalData.cartGoodsNum = num;
615 633 th.data.up_dating = 0
616   - th.getTabBar().setData({cartGoodsNum:num});
  634 + th.getTabBar().setData({ cartGoodsNum: num });
617 635 })
618 636  
619 637 }
620 638 });
621 639 },
622   -
623   - //------定时等待某个值,有值才进行运算--------
624   - waitfor:function(page,key,pop_value,func){
625   - var n=0;
626   - if(!page.data[key]){
627   - page.data[key]=setInterval(function(){
628   - console.log(page.data[key]);n++;
629   - if(pop_value) {
630   - clearInterval(page.data[key]);
631   - func();
632   - }
633   - if(n>15) clearInterval(page.data[key]);
634   - },1000);
635   - }
636   - },
637   -
638   - //------定时等待某个值,有值才进行运算--------
639   - waitfor2:function(page,key,pop_value_key,func){
640   - var n=0;
641   - if(!page.data[key]){
642   - page.data[key]=setInterval(function(){
643   - console.log(page.data[key]);n++;
644   - if(page.data[pop_value_key] && Object.keys(page.data[pop_value_key]).length>0) {
645   - clearInterval(page.data[key]);
646   - func();
647   - }
648   - if(n>15){
  640 +
  641 + //------定时等待某个值,有值才进行运算--------
  642 + waitfor: function (page, key, pop_value, func) {
  643 + var n = 0;
  644 + if (!page.data[key]) {
  645 + page.data[key] = setInterval(function () {
  646 + console.log(page.data[key]); n++;
  647 + if (pop_value) {
649 648 clearInterval(page.data[key]);
650 649 func();
651 650 }
652   - },1000);
653   - }
654   - },
  651 + if (n > 15) clearInterval(page.data[key]);
  652 + }, 1000);
  653 + }
  654 + },
  655 +
  656 + //------定时等待某个值,有值才进行运算--------
  657 + waitfor2: function (page, key, pop_value_key, func) {
  658 + var n = 0;
  659 + if (!page.data[key]) {
  660 + page.data[key] = setInterval(function () {
  661 + console.log(page.data[key]); n++;
  662 + if (page.data[pop_value_key] && Object.keys(page.data[pop_value_key]).length > 0) {
  663 + clearInterval(page.data[key]);
  664 + func();
  665 + }
  666 + if (n > 15) {
  667 + clearInterval(page.data[key]);
  668 + func();
  669 + }
  670 + }, 1000);
  671 + }
  672 + },
655 673  
656 674 //清空登录时候缓存的值
657   - onHide:function () {
658   - this.globalData.is_test=0;
659   - this.globalData.guide_id=null; //导购清空
660   - this.globalData.first_leader=null; //分享的会员清空
661   - this.globalData.wuliu=null; //关闭要把物流清空
662   - this.globalData.room_id=null; //关闭要把房间号关闭
663   - this.globalData.room_goods_id=null; //关闭要把物流清空
664   - this.globalData.config2=null; //清除config2的缓存
665   - this.globalData.config=null; //清除config的缓存
666   - this.globalData.gr_index=0; //商品分组的序列
667   - this.globalData.pk_store=null;
668   - this.globalData.wxapp_buy_obj=null;
669   - this.globalData.dis_buy_obj=null; //等级卡的购买记录
670   - this.globalData.storeFooter=null; //底部的导航
671   - this.globalData.full_screen=null; //全屏
672   -
673   - },
674   -
675   - clear_word:function (word) {
676   -
677   - var str=word;
678   - 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 ,
679   - indexArr = reg.exec(str);
680   - if(str.match(reg)) {
681   - str = str.replace(reg, '');
  675 + onHide: function () {
  676 + this.globalData.is_test = 0;
  677 + this.globalData.guide_id = null; //导购清空
  678 + this.globalData.first_leader = null; //分享的会员清空
  679 + this.globalData.wuliu = null; //关闭要把物流清空
  680 + this.globalData.room_id = null; //关闭要把房间号关闭
  681 + this.globalData.room_goods_id = null; //关闭要把物流清空
  682 + this.globalData.config2 = null; //清除config2的缓存
  683 + this.globalData.config = null; //清除config的缓存
  684 + this.globalData.gr_index = 0; //商品分组的序列
  685 + this.globalData.pk_store = null;
  686 + this.globalData.wxapp_buy_obj = null;
  687 + this.globalData.dis_buy_obj = null; //等级卡的购买记录
  688 + this.globalData.storeFooter = null; //底部的导航
  689 + this.globalData.full_screen = null; //全屏
  690 +
  691 + },
  692 +
  693 + clear_word: function (word) {
  694 +
  695 + var str = word;
  696 + 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,
  697 + indexArr = reg.exec(str);
  698 + if (str.match(reg)) {
  699 + str = str.replace(reg, '');
  700 + }
  701 + return str;
  702 + },
  703 +
  704 + getPageIndex: function (curPage) {
  705 +
  706 + var pagePath = curPage.route; //当前页面url
  707 + if (pagePath.indexOf('/') != 0) {
  708 + pagePath = '/' + pagePath;
  709 + }
  710 +
  711 + var index = 0;
  712 +
  713 + if (this.globalData.custum_data) {
  714 + var itemList = this.globalData.custum_data.data;
  715 + itemList = JSON.parse(itemList);
  716 + for (var i in itemList) {
  717 + var item = itemList[i]
  718 + if (pagePath.indexOf(item.weappurl) != -1) {
  719 + index = i; break;
  720 + }
  721 + }
  722 +
  723 + } else {
  724 + var itemList = this.def_list;
  725 + for (var i in itemList) {
  726 + var item = itemList[i]
  727 + if (pagePath.indexOf(item.weappurl) != -1) {
  728 + index = i; break;
  729 + }
682 730 }
683   - return str;
684   - },
685   -
686   - getPageIndex:function(curPage){
687   -
688   - var pagePath = curPage.route; //当前页面url
689   - if (pagePath.indexOf('/') != 0) {
690   - pagePath = '/' + pagePath;
691   - }
692   -
693   - var index=0;
694   -
695   - if(this.globalData.custum_data){
696   - var itemList = this.globalData.custum_data.data;
697   - itemList = JSON.parse(itemList);
698   - for(var i in itemList){
699   - var item=itemList[i]
700   - if(pagePath.indexOf(item.weappurl)!=-1){
701   - index=i;break;
702   - }
703   - }
704   -
705   - }else{
706   - var itemList=this.def_list;
707   - for(var i in itemList){
708   - var item=itemList[i]
709   - if(pagePath.indexOf(item.weappurl)!=-1){
710   - index=i;break;
711   - }
712   - }
713   - }
714   - return index;
715   -
716   - },
  731 + }
  732 + return index;
  733 +
  734 + },
717 735  
718 736 //---promise的使用get----
719   - promiseGet:function(url,data){
720   - if(url.indexOf("http")==-1) url=this.globalData.setting.url +url;
  737 + promiseGet: function (url, data) {
  738 + if (url.indexOf("http") == -1) url = this.globalData.setting.url + url;
721 739 return new Promise((resolve, reject) => {
722 740 data.isShowLoading && wx.showLoading();
723 741 wx.request({
724 742 url,
725 743 method: 'GET',
726   - header: {"content-type": "application/x-www-form-urlencoded" },
727   - data:data.data,
  744 + header: { "content-type": "application/x-www-form-urlencoded" },
  745 + data: data.data,
728 746 success(res) {
729 747 data.isShowLoading && wx.hideLoading();
730 748 resolve(res);
... ... @@ -736,40 +754,40 @@ App({
736 754  
737 755  
738 756 //---promise的使用get----
739   - requestGet:function(url,data){
740   - if(url.indexOf("http")==-1) url=this.globalData.setting.url +url;
741   - data.isShowLoading && wx.showLoading();
742   - wx.request({
743   - url,
744   - method: 'GET',
745   - header: {"content-type": "application/x-www-form-urlencoded" },
746   - data:data.data,
747   - success(res) {
748   - data.isShowLoading && wx.hideLoading();
749   - data.success(res);
750   - },
751   - fail(err) {
752   - data.isShowLoading && wx.hideLoading();
753   - if(data.fail) data.fail(err);
754   - }
755   - })
  757 + requestGet: function (url, data) {
  758 + if (url.indexOf("http") == -1) url = this.globalData.setting.url + url;
  759 + data.isShowLoading && wx.showLoading();
  760 + wx.request({
  761 + url,
  762 + method: 'GET',
  763 + header: { "content-type": "application/x-www-form-urlencoded" },
  764 + data: data.data,
  765 + success(res) {
  766 + data.isShowLoading && wx.hideLoading();
  767 + data.success(res);
  768 + },
  769 + fail(err) {
  770 + data.isShowLoading && wx.hideLoading();
  771 + if (data.fail) data.fail(err);
  772 + }
  773 + })
  774 + },
  775 +
  776 +
  777 + // 判断是否登录
  778 + isLogin() {
  779 + return new Promise(function (resolve, reject) {
  780 + let user_info = getApp().globalData.userInfo;
  781 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  782 + wx.navigateTo({
  783 + url: '/pages/togoin/togoin',
  784 + })
  785 + return false;
  786 + } else {
  787 + resolve(user_info);
  788 + };
  789 + });
756 790 },
757   -
758   -
759   - // 判断是否登录
760   - isLogin() {
761   - return new Promise(function(resolve, reject) {
762   - let user_info = getApp().globalData.userInfo;
763   - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
764   - wx.navigateTo({
765   - url: '/pages/togoin/togoin',
766   - })
767   - return false;
768   - } else {
769   - resolve(user_info);
770   - };
771   - });
772   - },
773 791  
774 792  
775 793 checkUpdateVersion() {
... ... @@ -777,19 +795,21 @@ App({
777 795 if (wx.canIUse('getUpdateManager')) {
778 796 //创建 UpdateManager 实例
779 797 const updateManager = wx.getUpdateManager();
780   - console.log('是否进入模拟更新');
  798 + if(!updateManager) {
  799 + return false;
  800 + }
781 801 //检测版本更新
782   - updateManager.onCheckForUpdate(function(res) {
  802 + updateManager.onCheckForUpdate(function (res) {
783 803 console.log('是否获取版本');
784 804 // 请求完新版本信息的回调
785 805 if (res.hasUpdate) {
786 806 //监听小程序有版本更新事件
787   - updateManager.onUpdateReady(function() {
  807 + updateManager.onUpdateReady(function () {
788 808  
789 809 //TODO 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 ( 此处进行了自动更新操作)
790 810 updateManager.applyUpdate();
791 811 })
792   - updateManager.onUpdateFailed(function() {
  812 + updateManager.onUpdateFailed(function () {
793 813 // 新版本下载失败
794 814 wx.showModal({
795 815 title: '已经有新版本喽~',
... ... @@ -810,6 +830,6 @@ App({
810 830  
811 831  
812 832  
813   -
  833 +
814 834  
815 835 });
... ...
app.json
... ... @@ -155,7 +155,6 @@
155 155 "pages/video/index",
156 156 "pages/boxes-list/boxes-list",
157 157 "pages/boxes-details/boxes-details"
158   -
159 158 ]
160 159 },
161 160 {
... ... @@ -193,8 +192,15 @@
193 192 "pages/AI-test-skin/fail_result/fail_result",
194 193 "pages/AI-test-skin/success_result/success_result",
195 194 "pages/AI-test-skin/analyse/analyse"
196   - ]
  195 + ],
  196 + "plugins": {
  197 + "mtSkinSdk": {
  198 + "version": "1.4.2",
  199 + "provider": "wx3636b350f8484f20"
  200 + }
  201 + }
197 202 }
  203 +
198 204 ],
199 205 "permission": {
200 206 "scope.userLocation": {
... ... @@ -256,4 +262,5 @@
256 262 "useExtendedLib": {
257 263 "weui": true
258 264 }
  265 +
259 266 }
260 267 \ No newline at end of file
... ...
packageA/pages/goodsInfo/goodsInfo.js
... ... @@ -212,6 +212,13 @@ Page({
212 212  
213 213 //------初始化加载----------
214 214 onLoad: function(t) {
  215 +
  216 + // ===> 小程序页面分享到朋友圈时使用
  217 + if(!getApp().is_Single_page()){
  218 + return false;
  219 + }
  220 + // <===
  221 +
215 222 self = this;
216 223  
217 224 this.setData({
... ...
packageA/pages/jfbuy/jfbuy.js
... ... @@ -65,6 +65,9 @@ Page({
65 65 * 生命周期函数--监听页面加载
66 66 */
67 67 onLoad: function (options) {
  68 + if(!getApp().is_Single_page()){
  69 + return false;
  70 + }
68 71 var th=this;
69 72 this.data.requestData={
70 73 store_id:oo.stoid,
... ...
packageA/pages/liveStream/liveStream.js
... ... @@ -208,6 +208,9 @@ Page({
208 208 * 生命周期函数--监听页面加载
209 209 */
210 210 onLoad: function (options) {
  211 + if(!getApp().is_Single_page()){
  212 + return false;
  213 + }
211 214 self = this;
212 215 // console.log('ppppp',this.pageTotal(4, 10));
213 216  
... ...
packageB/pages/zuhegou/index/index.js
... ... @@ -123,6 +123,9 @@ Page({
123 123 * 生命周期函数--监听页面加载
124 124 */
125 125 onLoad: function (options) {
  126 + if(!getApp().is_Single_page()){
  127 + return false;
  128 + }
126 129 console.log(options, 111);
127 130 self = this;
128 131 var the_id = options.id;
... ...
packageB/pages/zuhegou/preindex/index.js
... ... @@ -123,6 +123,9 @@ Page({
123 123 * 生命周期函数--监听页面加载
124 124 */
125 125 onLoad: function (options) {
  126 + if(!getApp().is_Single_page()){
  127 + return false;
  128 + }
126 129 console.log(options, 111);
127 130 self = this;
128 131 var the_id = options.id;
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... ... @@ -285,7 +285,9 @@ Page({
285 285  
286 286 //------初始化加载----------
287 287 onLoad: function (t) {
288   -
  288 + if(!getApp().is_Single_page()){
  289 + return false;
  290 + }
289 291 // console.log('onload');
290 292 if(t && t.group_id) {
291 293 this.data.group_id = t.group_id;
... ...
packageC/pages/presell/goodsInfo/goodsInfo.js
... ... @@ -252,6 +252,9 @@ Page({
252 252  
253 253 //------初始化加载----------
254 254 onLoad: function (t) {
  255 + if(!getApp().is_Single_page()){
  256 + return false;
  257 + }
255 258 var ee = this, that = ee, th = ee,
256 259 pre_id = t.pre_id,
257 260 gid = t.goods_id,
... ...
packageC/pages/presell/pregoodsInfo/goodsInfo.js
... ... @@ -252,6 +252,9 @@ Page({
252 252  
253 253 //------初始化加载----------
254 254 onLoad: function (t) {
  255 + if(!getApp().is_Single_page()){
  256 + return false;
  257 + }
255 258 var ee = this, that = ee, th = ee,
256 259 pre_id = t.pre_id,
257 260 gid = t.goods_id,
... ...
packageD/pages/AI-test-skin/analyse/analyse.js
... ... @@ -4,6 +4,7 @@ const request = app.request;
4 4 const os = app.globalData;
5 5 const setting = os.setting;
6 6 const ut = require('../../../../utils/util');
  7 +import { pluginGD } from '../../../ai_config/config'
7 8 Page({
8 9  
9 10 /**
... ... @@ -11,171 +12,174 @@ Page({
11 12 */
12 13 data: {
13 14 iurl: setting.imghost,
14   - per:0,
15   - timer:0,
16   - img:null,
17   - sourceimg:null,
18   - err_map:null,
  15 + per: 0,
  16 + timer: 0,
  17 + img: null,
  18 + sourceimg: null,
  19 + err_map: null,
19 20 },
20 21  
21 22 /**
22 23 * 生命周期函数--监听页面加载
23 24 */
24 25 onLoad: function (options) {
25   - var th=this;
26   - //设置错误码分析
27   - this.set_err_map();
28   - //进度条加载
29   - this.timer();
30   - //接口开始分析
31   - setTimeout(function () {
32   - //th.analysis_img();
33   - //先检验一下图片
34   - th.img_check(function () {
35   -
36   - });
37   - },800)
  26 + //初始化美图测肤插件
  27 + var plugin = requirePlugin('mtSkinSdk')
  28 + plugin.setConfig(pluginGD)
  29 + var th = this;
  30 + //设置错误码分析
  31 + this.set_err_map();
  32 + //进度条加载
  33 + this.timer();
  34 + //接口开始分析
  35 + setTimeout(function () {
  36 + //th.analysis_img();
  37 + //先检验一下图片
  38 + th.mt_check(function () {
  39 +
  40 + });
  41 + }, 800)
38 42  
39 43 },
40 44 //定时器
41   - timer:function (func) {
42   - var per=this.data.per+5;
43   - var th=this;
44   - if(per<96){
45   - th.setData({per:per});
46   - setTimeout(function () {
47   - th.timer();
48   - },400)
49   - }
  45 + timer: function (func) {
  46 + var per = this.data.per + 5;
  47 + var th = this;
  48 + if (per < 96) {
  49 + th.setData({ per: per });
  50 + setTimeout(function () {
  51 + th.timer();
  52 + }, 400)
  53 + }
50 54 },
51 55  
52 56 //错误码表
53   - set_err_map:function () {
54   - var map={
55   - "2":"服务暂不可用",
56   - "4":"集群超限额",
57   - "6":"没有接口权限",
58   - "17":"每天流量超限额",
59   - "18":"QPS超限额",
60   - "19":"请求总量超限额",
61   - "100":"无效的access_token参数",
62   - "110":"Access Token失效",
63   - "111":" Access token过期",
64   - "222001":"必要参数未传入",
65   - "222002":"参数格式错误",
66   - "222003":"参数格式错误",
67   - "222004":"参数格式错误",
68   - "222005":"参数格式错误",
69   - "222006":"参数格式错误",
70   - "222007":"参数格式错误",
71   - "222008":"参数格式错误",
72   - "222009":"参数格式错误",
73   - "222010":"参数格式错误",
74   - "222011":"参数格式错误",
75   - "222012":"参数格式错误",
76   - "222013":"参数格式错误",
77   - "222014":"参数格式错误",
78   - "222015":"参数格式错误",
79   - "222016":"参数格式错误",
80   - "222017":"参数格式错误",
81   - "222018":"参数格式错误",
82   - "222019":"参数格式错误",
83   - "222020":"参数格式错误",
84   - "222021":"参数格式错误",
85   - "222022":"身份证号不符合要求,备注:中国大陆身份证号的每一位数字都有其生成规则,不可随意填写。",
86   - "222023":"参数格式错误",
87   - "222024":"参数格式错误",
88   - "222025":"参数格式错误",
89   - "222026":"参数格式错误",
90   - "222027":"验证码长度错误(最小值大于最大值)",
91   - "222028":"参数格式错误",
92   - "222029":"参数格式错误",
93   - "222030":"参数格式错误",
94   - "222039":"参数格式错误",
95   - "222200":"该接口需使用application/json的格式进行请求",
96   - "222201":"服务端请求失败",
97   - "222202":"图片中没有人脸",
98   - "222203":"无法解析人脸",
99   - "222204":"从图片的url下载图片失败",
100   - "222205":"服务端请求失败",
101   - "222206":"服务端请求失败",
102   - "222207":"未找到匹配的用户",
103   - "222208":"图片的数量错误",
104   - "222209":"face token不存在",
105   - "222210":"人脸库中用户下的人脸数目超过限制",
106   - "222300":"人脸图片添加失败",
107   - "222301":"获取人脸图片失败",
108   - "222302":"服务端请求失败",
109   - "222303":"获取人脸图片失败",
110   - "222152":"人脸属性编辑,target参数错误",
111   - "222514":"人脸属性编辑v2调用服务失败,请重试",
112   - "223100":"操作的用户组不存在",
113   - "223101":"该用户组已存在",
114   - "223102":"找不到该用户",
115   - "223103":"找不到该用户",
116   - "223104":"group_list包含组数量过多",
117   - "223105":"该人脸已存在",
118   - "223106":"该人脸不存在",
119   - "223107":"人脸库中人脸复制时源组与目标组的scene_type不同",
120   - "223110":"uid_list包含数量过多",
121   - "223111":"目标用户组不存在",
122   - "223112":"quality_conf格式不正确",
123   - "223113":"人脸有被遮挡",
124   - "223114":"人脸模糊",
125   - "223115":"人脸光照不好",
126   - "223116":"人脸不完整",
127   - "223117":"app_list包含app数量过多",
128   - "223118":"质量控制项错误",
129   - "223119":"活体控制项错误",
130   - "223120":"活体检测未通过",
131   - "223121":"质量检测未通过 左眼遮挡程度过高",
132   - "223122":"质量检测未通过 右眼遮挡程度过高",
133   - "223123":"质量检测未通过 左脸遮挡程度过高",
134   - "223124":"质量检测未通过 右脸遮挡程度过高",
135   - "223125":"质量检测未通过 下巴遮挡程度过高",
136   - "223126":"质量检测未通过 鼻子遮挡程度过高",
137   - "223127":"质量检测未通过 嘴巴遮挡程度过高",
138   - "222901":"参数校验初始化失败",
139   - "222902":"参数校验初始化失败",
140   - "222903":"参数校验初始化失败",
141   - "222904":"参数校验初始化失败",
142   - "222905":"接口初始化失败",
143   - "222906":"接口初始化失败",
144   - "222907":"缓存处理失败",
145   - "222908":"缓存处理失败",
146   - "222909":"缓存处理失败",
147   - "222910":"数据存储处理失败",
148   - "222911":"数据存储处理失败",
149   - "222912":"数据存储处理失败",
150   - "222913":"接口初始化失败",
151   - "222914":"接口初始化失败",
152   - "222915":"后端服务连接失败",
153   - "222916":"后端服务连接失败",
154   - "222304":"图片尺寸太大",
155   - "222305":"当前版本不支持图片存储",
156   - "223128":"正在清理该用户组的数据",
157   - "223136":"该组内存在关联图片,无法新建相同名称组",
158   - "222361":"公安服务连接失败",
159   - "222046":"参数格式错误",
160   - "222101":"参数格式错误",
161   - "222102":"参数格式错误",
162   - "222307":"图片非法 鉴黄未通过",
163   - "222308":"图片非法 含有政治敏感人物",
164   - "222211":"人脸融合失败 模板图质量不合格",
165   - "222212":"人脸融合失败",
166   - "223129":"人脸未面向正前方(人脸的角度信息大于30度)",
167   - "223130":"spoofing_control参数格式错误",
168   - "223131":"合成图检测未通过",
169   - "223201":"请求参数scene_type 格式错误",
170   - "223202":"识别时请求的scene_type与group设置的scene_type不匹配",
171   - }
172   - this.setData({err_map:map});
  57 + set_err_map: function () {
  58 + var map = {
  59 + "2": "服务暂不可用",
  60 + "4": "集群超限额",
  61 + "6": "没有接口权限",
  62 + "17": "每天流量超限额",
  63 + "18": "QPS超限额",
  64 + "19": "请求总量超限额",
  65 + "100": "无效的access_token参数",
  66 + "110": "Access Token失效",
  67 + "111": " Access token过期",
  68 + "222001": "必要参数未传入",
  69 + "222002": "参数格式错误",
  70 + "222003": "参数格式错误",
  71 + "222004": "参数格式错误",
  72 + "222005": "参数格式错误",
  73 + "222006": "参数格式错误",
  74 + "222007": "参数格式错误",
  75 + "222008": "参数格式错误",
  76 + "222009": "参数格式错误",
  77 + "222010": "参数格式错误",
  78 + "222011": "参数格式错误",
  79 + "222012": "参数格式错误",
  80 + "222013": "参数格式错误",
  81 + "222014": "参数格式错误",
  82 + "222015": "参数格式错误",
  83 + "222016": "参数格式错误",
  84 + "222017": "参数格式错误",
  85 + "222018": "参数格式错误",
  86 + "222019": "参数格式错误",
  87 + "222020": "参数格式错误",
  88 + "222021": "参数格式错误",
  89 + "222022": "身份证号不符合要求,备注:中国大陆身份证号的每一位数字都有其生成规则,不可随意填写。",
  90 + "222023": "参数格式错误",
  91 + "222024": "参数格式错误",
  92 + "222025": "参数格式错误",
  93 + "222026": "参数格式错误",
  94 + "222027": "验证码长度错误(最小值大于最大值)",
  95 + "222028": "参数格式错误",
  96 + "222029": "参数格式错误",
  97 + "222030": "参数格式错误",
  98 + "222039": "参数格式错误",
  99 + "222200": "该接口需使用application/json的格式进行请求",
  100 + "222201": "服务端请求失败",
  101 + "222202": "图片中没有人脸",
  102 + "222203": "无法解析人脸",
  103 + "222204": "从图片的url下载图片失败",
  104 + "222205": "服务端请求失败",
  105 + "222206": "服务端请求失败",
  106 + "222207": "未找到匹配的用户",
  107 + "222208": "图片的数量错误",
  108 + "222209": "face token不存在",
  109 + "222210": "人脸库中用户下的人脸数目超过限制",
  110 + "222300": "人脸图片添加失败",
  111 + "222301": "获取人脸图片失败",
  112 + "222302": "服务端请求失败",
  113 + "222303": "获取人脸图片失败",
  114 + "222152": "人脸属性编辑,target参数错误",
  115 + "222514": "人脸属性编辑v2调用服务失败,请重试",
  116 + "223100": "操作的用户组不存在",
  117 + "223101": "该用户组已存在",
  118 + "223102": "找不到该用户",
  119 + "223103": "找不到该用户",
  120 + "223104": "group_list包含组数量过多",
  121 + "223105": "该人脸已存在",
  122 + "223106": "该人脸不存在",
  123 + "223107": "人脸库中人脸复制时源组与目标组的scene_type不同",
  124 + "223110": "uid_list包含数量过多",
  125 + "223111": "目标用户组不存在",
  126 + "223112": "quality_conf格式不正确",
  127 + "223113": "人脸有被遮挡",
  128 + "223114": "人脸模糊",
  129 + "223115": "人脸光照不好",
  130 + "223116": "人脸不完整",
  131 + "223117": "app_list包含app数量过多",
  132 + "223118": "质量控制项错误",
  133 + "223119": "活体控制项错误",
  134 + "223120": "活体检测未通过",
  135 + "223121": "质量检测未通过 左眼遮挡程度过高",
  136 + "223122": "质量检测未通过 右眼遮挡程度过高",
  137 + "223123": "质量检测未通过 左脸遮挡程度过高",
  138 + "223124": "质量检测未通过 右脸遮挡程度过高",
  139 + "223125": "质量检测未通过 下巴遮挡程度过高",
  140 + "223126": "质量检测未通过 鼻子遮挡程度过高",
  141 + "223127": "质量检测未通过 嘴巴遮挡程度过高",
  142 + "222901": "参数校验初始化失败",
  143 + "222902": "参数校验初始化失败",
  144 + "222903": "参数校验初始化失败",
  145 + "222904": "参数校验初始化失败",
  146 + "222905": "接口初始化失败",
  147 + "222906": "接口初始化失败",
  148 + "222907": "缓存处理失败",
  149 + "222908": "缓存处理失败",
  150 + "222909": "缓存处理失败",
  151 + "222910": "数据存储处理失败",
  152 + "222911": "数据存储处理失败",
  153 + "222912": "数据存储处理失败",
  154 + "222913": "接口初始化失败",
  155 + "222914": "接口初始化失败",
  156 + "222915": "后端服务连接失败",
  157 + "222916": "后端服务连接失败",
  158 + "222304": "图片尺寸太大",
  159 + "222305": "当前版本不支持图片存储",
  160 + "223128": "正在清理该用户组的数据",
  161 + "223136": "该组内存在关联图片,无法新建相同名称组",
  162 + "222361": "公安服务连接失败",
  163 + "222046": "参数格式错误",
  164 + "222101": "参数格式错误",
  165 + "222102": "参数格式错误",
  166 + "222307": "图片非法 鉴黄未通过",
  167 + "222308": "图片非法 含有政治敏感人物",
  168 + "222211": "人脸融合失败 模板图质量不合格",
  169 + "222212": "人脸融合失败",
  170 + "223129": "人脸未面向正前方(人脸的角度信息大于30度)",
  171 + "223130": "spoofing_control参数格式错误",
  172 + "223131": "合成图检测未通过",
  173 + "223201": "请求参数scene_type 格式错误",
  174 + "223202": "识别时请求的scene_type与group设置的scene_type不匹配",
  175 + }
  176 + this.setData({ err_map: map });
173 177 },
174 178  
175 179 /**
176 180 * 生命周期函数--监听页面显示
177 181 */
178   - onShow: function (){ },
  182 + onShow: function () { },
179 183  
180 184 /**
181 185 * 生命周期函数--监听页面隐藏
... ... @@ -199,159 +203,317 @@ Page({
199 203  
200 204 },
201 205  
  206 + mt_check() {
  207 + let img_info = getApp().globalData.skin_img_info;
  208 + var plugin = requirePlugin('mtSkinSdk');
  209 + let th = this;
  210 + plugin.facePoseCorrect({
  211 + path: img_info['path'],
  212 + size: img_info['size'],
  213 + success(res) {
  214 + console.log('=========姿态校正 成功==========')
  215 + console.log('姿态校正结果', res)
  216 + let analyse_info = res.data;
  217 + //检查闭眼情况
  218 + if (analyse_info.analyse_info) {
  219 + //检查睁眼闭眼
  220 + let { left, right } = analyse_info.analyse_info;
  221 + if (left !== 2 || right !== 2) {
  222 + var msg = "未闭眼拍照";
  223 + th.go_error(msg);
  224 + return false;
  225 + }
  226 + }
  227 + //检查佩戴情况
  228 + if (analyse_info.faceGlasses) {
  229 + let { none, normal, sunglasses } = analyse_info.faceGlasses;
  230 + if (normal > 0.8 || sunglasses > 0.8 || none < 0.1) {
  231 + var msg = "有佩戴眼镜";
  232 + th.go_error(msg);
  233 + return false;
  234 + }
  235 + }
  236 + //检查框里情况
  237 + if (analyse_info.faceOutDetect.outBound == 1) {
  238 + var msg = "未在取景框内";
  239 + th.go_error(msg);
  240 + return false;
  241 + }
  242 + // if (analyse_info.facePoseEuler) {
  243 + // let { pitch, roll, yaw } = analyse_info.facePoseEuler;
  244 + // if (normal > 0.8 || sunglasses > 0.8 || none < 0.1) {
  245 + // var msg = "有佩戴眼镜";
  246 + // th.go_error(msg);
  247 + // return false;
  248 + // }
  249 + // }
  250 + //检查环境情况
  251 + if (analyse_info.faceQuality) {
  252 + let { bright, blur, compression } = analyse_info.faceQuality;
  253 + if (bright > 80) {
  254 + var msg = "亮度过亮";
  255 + th.go_error(msg);
  256 + return false;
  257 + }
  258 + if (bright < 20 || blur < 20) {
  259 + var msg = "亮度过暗或图片过于模糊";
  260 + th.go_error(msg);
  261 + return false;
  262 + }
  263 + }
  264 + //检查距离
  265 + if (analyse_info.faceRatio < 0.2) {
  266 + var msg = "距离过远";
  267 + th.go_error(msg);
  268 + return false;
  269 + }
  270 + if (analyse_info.faceRatio > 0.8) {
  271 + var msg = "距离过近";
  272 + th.go_error(msg);
  273 + return false;
  274 + }
  275 + //检查遮挡物
  276 + if (analyse_info.faceVisibility) {
  277 + var msg = "";
  278 + let fail = Object.keys(analyse_info.faceVisibility).filter(key => {
  279 + return analyse_info.faceVisibility[key] <= 80;
  280 + })
  281 + console.log('fail', fail);
  282 + switch (fail[0]) {
  283 + case "jaw":
  284 + msg = "下巴有遮挡";
  285 + break;
  286 + case "leftcheek":
  287 + msg = "左脸有遮挡";
  288 + break;
  289 + case "lefteye":
  290 + msg = "左眼有遮挡";
  291 + break;
  292 + case "lefteyebrow":
  293 + msg = "左眉毛有遮挡";
  294 + break;
  295 + case "mouse":
  296 + msg = "嘴巴有遮挡";
  297 + break;
  298 + case "nose":
  299 + msg = "鼻子有遮挡";
  300 + break;
  301 + case "rightcheek":
  302 + msg = "右脸有遮挡";
  303 + break;
  304 + case "righteye":
  305 + msg = "右眼有遮挡";
  306 + break;
  307 + case "rightyebrow":
  308 + msg = "右眉毛有遮挡";
  309 + break;
  310 + }
  311 + if (msg) {
  312 + th.go_error(msg);
  313 + return false;
  314 + }
  315 + }
  316 + th.analyse_by_mtapi(img_info);
  317 + },
  318 + fail(err) {
  319 + th.go_error('识别有误,请重试');
  320 + return false;
  321 + }
  322 + })
  323 +
  324 + },
  325 +
  326 + analyse_by_mtapi(img_info) {
  327 + // let img_info = getApp().globalData.skin_img_info;
  328 + let th = this;
  329 + var plugin = requirePlugin('mtSkinSdk')
  330 + plugin.detectImage({
  331 + path: img_info['path'],
  332 + size: img_info['size'],
  333 + success(res) {
  334 + console.log('=========用户传图片链接获取检测结果 成功==========')
  335 + console.log('检测结果', res);
  336 + let req_data = {
  337 + store_id: setting.stoid,
  338 + user_id: getApp().globalData.user_id,
  339 + img: getApp().globalData.face_img,
  340 + sourceimg: getApp().globalData.face_SourceImg,
  341 + addtime: ut.gettimestamp(),
  342 + resultjson: JSON.stringify(res.data.data),
  343 + detectjson: JSON.stringify(th.data.check_data)
  344 + }
  345 + //要保存一下分析的结果
  346 + th.json_post("/api/weshop/face/storeSkinface/save", req_data, function (res) {
  347 + if (res.data.code == 0) {
  348 + let url = "/packageD/pages/AI-test-skin/success_result/success_result?id=" + res.data.data.id; //跳到分析页
  349 + wx.redirectTo({
  350 + url: url
  351 + })
  352 + } else {
  353 + getApp().showWarning("保存失败");
  354 + }
  355 + })
  356 + },
  357 + fail(err) {
  358 + console.error('=========用户传图片链接获取检测结果 失败==========')
  359 + console.log('error', err)
  360 + }
  361 + })
  362 + },
  363 +
202 364 //检查图片有没有OK
203   - img_check:function (func) {
204   - var th=this;
205   - var data={
  365 + img_check: function (func) {
  366 + var th = this;
  367 + var data = {
206 368 "appid": "25521854",
207 369 "image": getApp().globalData.face_SourceImg,
208 370 "face_field": "age,expression,face_shape,gender,glasses,landmark,landmark150,quality,eye_status,emotion,face_type,mask,spoofing",
209 371 "image_type": "URL"
210 372 }
211 373 //开始调用接口,进行对图片进行判断是否符合标准
212   - this.json_post("/api/weshop/baidubce/face/skindetect",data,function (res) {
213   - if(res.data.code==0){
  374 + this.json_post("/api/weshop/baidubce/face/skindetect", data, function (res) {
  375 + if (res.data.code == 0) {
214 376 //检查的字段存储
215   - var check_data=th.data.check_data=res.data.data;
216   - check_data=check_data.face_list[0];
  377 + var check_data = th.data.check_data = res.data.data;
  378 + check_data = check_data.face_list[0];
217 379 console.log(check_data);
218 380 //检查睁眼闭眼
219   - var eye_status=check_data.eye_status;
220   - if(eye_status.left_eye>0.1 || eye_status.right_eye>0.1) {
221   - var msg="未闭眼拍照";
  381 + var eye_status = check_data.eye_status;
  382 + if (eye_status.left_eye > 0.1 || eye_status.right_eye > 0.1) {
  383 + var msg = "未闭眼拍照";
222 384 th.go_error(msg);
223 385 return false;
224 386 }
225 387 //检查是不是有带眼镜
226   - if(check_data.glasses.type!='none'){
227   - var msg="有佩戴眼镜";
  388 + if (check_data.glasses.type != 'none') {
  389 + var msg = "有佩戴眼镜";
228 390 th.go_error(msg);
229 391 return false;
230 392 }
231 393 //检查头部的角度
232   - var angle=check_data.angle;
233   - if(Math.abs(angle.Pitch)>20) {
234   - var msg="头部的俯仰角度过大";
  394 + var angle = check_data.angle;
  395 + if (Math.abs(angle.Pitch) > 20) {
  396 + var msg = "头部的俯仰角度过大";
235 397 th.go_error(msg);
236 398 return false;
237 399 }
238   - if(Math.abs(angle.Roll)>20) {
239   - var msg="头部的平面角度过大";
  400 + if (Math.abs(angle.Roll) > 20) {
  401 + var msg = "头部的平面角度过大";
240 402 th.go_error(msg);
241 403 return false;
242 404 }
243   - if(Math.abs(angle.Yaw)>20) {
244   - var msg="头部的左右角度过大";
  405 + if (Math.abs(angle.Yaw) > 20) {
  406 + var msg = "头部的左右角度过大";
245 407 th.go_error(msg);
246 408 return false;
247 409 }
248   - var quality=check_data.quality;
249   - if(quality.blur>0.7){
250   - var msg="图片模糊";
  410 + var quality = check_data.quality;
  411 + if (quality.blur > 0.7) {
  412 + var msg = "图片模糊";
251 413 th.go_error(msg);
252 414 return false;
253 415 }
254 416 //开始检查遮挡
255   - var occlusion=check_data.quality.occlusion;
256   - if(occlusion.left_eye >0.6){
257   - var msg="左眼被遮挡";
  417 + var occlusion = check_data.quality.occlusion;
  418 + if (occlusion.left_eye > 0.6) {
  419 + var msg = "左眼被遮挡";
258 420 th.go_error(msg);
259 421 return false;
260 422 }
261   - if(occlusion.right_eye>0.6){
262   - var msg="右眼被遮挡";
  423 + if (occlusion.right_eye > 0.6) {
  424 + var msg = "右眼被遮挡";
263 425 th.go_error(msg);
264 426 return false;
265 427 }
266   - if(occlusion.nose>0.7){
267   - var msg="鼻子被遮挡";
  428 + if (occlusion.nose > 0.7) {
  429 + var msg = "鼻子被遮挡";
268 430 th.go_error(msg);
269 431 return false;
270 432 }
271   - if(occlusion.mouth>0.7){
272   - var msg="嘴巴被遮挡";
  433 + if (occlusion.mouth > 0.7) {
  434 + var msg = "嘴巴被遮挡";
273 435 th.go_error(msg);
274 436 return false;
275 437 }
276   - if(occlusion.left_cheek >0.8){
277   - var msg="左脸颊被遮挡";
  438 + if (occlusion.left_cheek > 0.8) {
  439 + var msg = "左脸颊被遮挡";
278 440 th.go_error(msg);
279 441 return false;
280 442 }
281   - if(occlusion.right_cheek >0.8){
282   - var msg="右脸颊被遮挡";
  443 + if (occlusion.right_cheek > 0.8) {
  444 + var msg = "右脸颊被遮挡";
283 445 th.go_error(msg);
284 446 return false;
285 447 }
286   - if(occlusion.chin_contour >0.6){
287   - var msg="下巴颊被遮挡";
  448 + if (occlusion.chin_contour > 0.6) {
  449 + var msg = "下巴颊被遮挡";
288 450 th.go_error(msg);
289 451 return false;
290 452 }
291   - if(quality.illumination<40){
292   - var msg="图像光照不足";
  453 + if (quality.illumination < 40) {
  454 + var msg = "图像光照不足";
293 455 th.go_error(msg);
294 456 return false;
295 457 }
296   - if(quality.completeness=0){
297   - var msg="人脸未显示完整";
  458 + if (quality.completeness = 0) {
  459 + var msg = "人脸未显示完整";
298 460 th.go_error(msg);
299 461 return false;
300 462 }
301 463 //-- 开始调用分析的接口 --
302   - var face_token=check_data.face_token;
303   - var data={
  464 + var face_token = check_data.face_token;
  465 + var data = {
304 466 "image": face_token,
305 467 "face_field": "color,smooth,acnespotmole,wrinkle,eyesattr,blackheadpore,skinface,skinquality",
306 468 "image_type": "FACE_TOKEN"
307 469 }
308 470 th.analysis_img(data);
309   - }else{
310   - var msg=th.data.err_map[res.data.code+""];
  471 + } else {
  472 + var msg = th.data.err_map[res.data.code + ""];
311 473 th.go_error(msg);
312 474 }
313 475 })
314 476 },
315   -
  477 +
316 478 //跳转到错误页面
317   - go_error:function (msg) {
318   - let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页
  479 + go_error: function (msg) {
  480 + let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页
319 481 wx.redirectTo({
320 482 url: url
321 483 });
322 484 },
323 485  
324   - analysis_img:function (data) {
325   - var th=this;
  486 + analysis_img: function (data) {
  487 + var th = this;
326 488 //开始调用接口,进行分析
327   - this.json_post("/api/weshop/baidubce/face/skinAnalyze",data,function (res) {
328   - if(res.data.code==0){
329   - getApp().globalData.face_result=res.data.data;
330   - var req_data={
331   - store_id:setting.stoid,
332   - user_id:getApp().globalData.user_id,
333   - img:getApp().globalData.face_img,
334   - sourceimg:getApp().globalData.face_SourceImg,
335   - addtime:ut.gettimestamp(),
336   - resultjson:JSON.stringify(res.data.data),
337   - detectjson:JSON.stringify(th.data.check_data)
  489 + this.json_post("/api/weshop/baidubce/face/skinAnalyze", data, function (res) {
  490 + if (res.data.code == 0) {
  491 + getApp().globalData.face_result = res.data.data;
  492 + var req_data = {
  493 + store_id: setting.stoid,
  494 + user_id: getApp().globalData.user_id,
  495 + img: getApp().globalData.face_img,
  496 + sourceimg: getApp().globalData.face_SourceImg,
  497 + addtime: ut.gettimestamp(),
  498 + resultjson: JSON.stringify(res.data.data),
  499 + detectjson: JSON.stringify(th.data.check_data)
338 500 }
339 501 //要保存一下分析的结果
340   - th.json_post("/api/weshop/face/storeSkinface/save",req_data,function (res) {
341   - if(res.data.code==0){
342   - let url = "/packageD/pages/AI-test-skin/success_result/success_result?id="+res.data.data.id; //跳到分析页
  502 + th.json_post("/api/weshop/face/storeSkinface/save", req_data, function (res) {
  503 + if (res.data.code == 0) {
  504 + let url = "/packageD/pages/AI-test-skin/success_result/success_result?id=" + res.data.data.id; //跳到分析页
343 505 wx.redirectTo({
344 506 url: url
345 507 })
346   - }else{
  508 + } else {
347 509 getApp().showWarning("保存失败");
348 510 }
349 511 })
350   - }else{
351   - var msg=th.data.err_map[res.data.code+""];
352   - let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页
  512 + } else {
  513 + var msg = th.data.err_map[res.data.code + ""];
  514 + let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页
353 515 wx.redirectTo({
354   - url: url
  516 + url: url
355 517 })
356 518 }
357 519 })
... ... @@ -363,10 +525,10 @@ Page({
363 525 * @param {Object} succ //成功的回调
364 526 * @param {Object} fail //失败的回调
365 527 */
366   - json_post:function(url,data,succ,fail,mathod){
367   - var Mathod="POST";
  528 + json_post: function (url, data, succ, fail, mathod) {
  529 + var Mathod = "POST";
368 530 if (mathod) Mathod = mathod;
369   - if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url;
  531 + if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
370 532 var str = JSON.stringify(data);
371 533 wx.request({
372 534 url: url,
... ... @@ -375,8 +537,8 @@ Page({
375 537 header: {
376 538 'content-type': 'application/json'
377 539 },// 设置请求的 header
378   - success: function (res) {succ(res); },
379   - fail:function(res){fail(res);}
  540 + success: function (res) { succ(res); },
  541 + fail: function (res) { fail(res); }
380 542 })
381 543 },
382 544  
... ...
packageD/pages/AI-test-skin/fail_result/fail_result.wxml
... ... @@ -3,7 +3,7 @@
3 3 <view>
4 4 <view style="position: relative;display: inline-block">
5 5 <text class="iconfont icon-tupian" style="color: #4bd6df;font-size: 80rpx"></text>
6   - <text class="iconfont icon-prompt-filling" style="color:red;font-size: 40rpx;position:absolute;left: -8rpx;top: 0;"></text>
  6 + <text class="iconfont .icon-infofill" style="color:red;font-size: 40rpx;position:absolute;left: -8rpx;top: 0;"></text>
7 7 </view>
8 8 </view>
9 9 <view style="font-size:32rpx;color: #333">上传图片符合要求</view>
... ... @@ -14,7 +14,7 @@
14 14 <view style="padding:60rpx; padding-bottom: 70rpx;">
15 15 <view style="font-size: 32rpx;">失败原因:</view>
16 16 <view style="font-size: 26rpx;display: flex;align-items: center; margin-top: 20prx">
17   - <text class="iconfont icon-account" style="font-size: 56rpx;margin-right: 20rpx"></text>
  17 + <text class="iconfont icon-geren" style="font-size: 56rpx;margin-right: 20rpx"></text>
18 18 <view>{{msg}}</view>
19 19 </view>
20 20 </view>
... ...
packageD/pages/AI-test-skin/fail_result/fail_result.wxss
... ... @@ -60,43 +60,10 @@ page {
60 60 justify-content: center;
61 61 }
62 62 .ac{align-items: center}
63   -
64   -@font-face {
65   - font-family: 'iconfont';
66   - /* project id 2125414 */
67   - src: url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.eot');
68   - src: url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.eot?#iefix') format('embedded-opentype'),
69   - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.woff2') format('woff2'),
70   - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.woff') format('woff'),
71   - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.ttf') format('truetype'),
72   - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.svg#iconfont') format('svg');
73   -}
74   -
75   -.icon-pic:before {
76   - content: "\e620";
77   -}
78   -
79 63 .t_c{text-align: center}
80 64  
81 65  
82   -@font-face {
83   - font-family: "iconfont"; /* Project id 3188718 */
84   - src: url('iconfont.woff2?t=1645080046840') format('woff2'),
85   - url('iconfont.woff?t=1645080046840') format('woff'),
86   - url('iconfont.ttf?t=1645080046840') format('truetype');
87   -}
88 66  
89   -.icon-tupian:before {
90   - content: "\e997";
91   -}
92   -
93   -.icon-account:before {
94   - content: "\e6a3";
95   -}
96   -
97   -.icon-prompt-filling:before {
98   - content: "\e68b";
99   -}
100 67  
101 68  
102 69  
... ...
packageD/pages/AI-test-skin/success_result/success_result.js
1 1 /*
2 2 * @Author: abson
3 3 * @Date: 2022-02-16 15:36:47
4   - * @LastEditTime: 2022-02-25 11:10:36
  4 + * @LastEditTime: 2022-02-25 11:30:33
5 5 * @LastEditors: Please set LastEditors
6 6 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
7 7 * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\success_result\success_result.js
... ... @@ -470,6 +470,7 @@ Page({
470 470 this.setData({
471 471 question_dialog:false,
472 472 yiwen_index:0,
  473 + yiwen_id:'yiwen1'
473 474 })
474 475 },
475 476  
... ...
packageD/pages/AI-test-skin/success_result/success_result.wxml
... ... @@ -120,10 +120,10 @@
120 120  
121 121  
122 122 <view class="mask" catchtap="close_mask" wx:if="{{showDialog || question_dialog}}"></view>
123   -<cover-view bindtap="saveImageToPhotosAlbum" class="share fs28">
124   - <cover-view class="iconfont icon-zhuanfa1" style="padding: 0 10rpx;"></cover-view>
125   - <cover-view>分享</cover-view>
126   -</cover-view>
  123 +<view bindtap="saveImageToPhotosAlbum" class="share fs28">
  124 + <view class="iconfont icon-zhuanfa1" style="padding: 0 10rpx;"></view>
  125 + <view>分享</view>
  126 +</view>
127 127  
128 128 <!-- 问题标注 -->
129 129 <view class="dialog {{img_scale?'scale':'fangda'}}" wx:if="{{showDialog}}">
... ... @@ -227,14 +227,14 @@
227 227 <!-- <text class="iconfont icon-yanjing-guan mgb20"></text> -->
228 228 <text catchtap="click_fangda" class="iconfont icon-fangda mgb20"></text>
229 229 </view>
230   - <block wx:if="{{show_type == 6}}">
  230 + <!-- <block wx:if="{{show_type == 6}}">
231 231 <view class="cuochuang">
232 232 <view class="cuochuang_icon">囊肿</view>
233 233 <view class="cuochuang_icon">丘疹</view>
234 234 <view class="cuochuang_icon">粉刺</view>
235 235 <view class="cuochuang_icon">痘印</view>
236 236 </view>
237   - </block>
  237 + </block> -->
238 238 </view>
239 239 <!-- 文字显示区 -->
240 240 <view class="dialog_txt" style="{{show_type == 5?'height:40%':'height:25%'}}">
... ... @@ -386,7 +386,7 @@
386 386 <view id="share_show" wx:if="{{share_show}}">
387 387 <view class="cover-layer" bindtap="close_share" style="z-index: 77777"></view>
388 388 <view class="share_content">
389   - <view class="sh_close" bindtap="close_share"><text class="iconfont icon-close"></text></view>
  389 + <view class="sh_close" bindtap="close_share"><text class="iconfont icon-guan"></text></view>
390 390 <image src="{{shareImgPath}}" style="width: 100%" mode="widthFix"></image>
391 391 <view class="share_save_btn" bindtap="savePic">保存到相册</view>
392 392 </view>
... ...
packageD/pages/AI-test-skin/success_result/success_result.wxss
... ... @@ -753,16 +753,6 @@ page {
753 753 color: #fff
754 754 }
755 755  
756   -@font-face {
757   - font-family: "iconfont";
758   - /* Project id */
759   - src: url('iconfont.ttf?t=1645607343376') format('truetype');
760   -}
761   -
762   -.icon-close:before {
763   - content: "\e668";
764   -}
765   -
766 756 .e_tou {
767 757 width: 50rpx;
768 758 height: 20rpx;
... ...
pages/activity/pind_list/pind_list.js
... ... @@ -22,6 +22,9 @@ Page({
22 22  
23 23 //------初始化加载----------
24 24 onLoad: function (t) {
  25 + if(!getApp().is_Single_page()){
  26 + return false;
  27 + }
25 28 wx.setNavigationBarTitle({
26 29 title: "天天拼单",
27 30 })
... ...
pages/activity/seckill_list/seckill_list.js
... ... @@ -21,6 +21,9 @@ Page({
21 21  
22 22 //------初始化加载----------
23 23 onLoad: function (t) {
  24 + if(!getApp().is_Single_page()){
  25 + return false;
  26 + }
24 27 wx.setNavigationBarTitle({
25 28 title: "商品秒杀",
26 29 })
... ...
pages/cart/cart/cart.wxml
... ... @@ -4,9 +4,9 @@
4 4 -->
5 5 <!-- 广告图片 -->
6 6  
7   -<navigator class="picture" url="/pages/activity/seckill_list/seckill_list" wx:if="{{is_has_flash}}">
  7 +<!-- <navigator class="picture" url="/pages/activity/seckill_list/seckill_list" wx:if="{{is_has_flash}}">
8 8 <image mode="widthFix" class="picture" src="{{iurl}}miniapp/images/stores/Seckill.png"></image>
9   -</navigator>
  9 +</navigator> -->
10 10  
11 11 <block wx:if="{{ad_data}}">
12 12 <swiper class="swiper" circular="true" autoplay="true"
... ...
pages/giftpack/buygiftpack/giftpackbuy.js
... ... @@ -29,6 +29,9 @@ Page({
29 29 first_leader: e.globalData.first_leader || 0, // 推荐人ID
30 30 },
31 31 onLoad: function (options) {
  32 + if(!getApp().is_Single_page()){
  33 + return false;
  34 + }
32 35 var th = this;
33 36 var my_confirm = th.selectComponent("#my_confirm"); //组件的id
34 37 my_confirm.open_cancel(0);
... ...
pages/giftpack/giftpacklist/giftpacklist.js
... ... @@ -32,6 +32,9 @@ Page({
32 32 first_leader: e.globalData.first_leader || 0, // 推荐人ID
33 33 },
34 34 onLoad: function (options) {
  35 + if(!getApp().is_Single_page()){
  36 + return false;
  37 + }
35 38 var th = this;
36 39 th.setData({
37 40 isBuy: options.isBuy,
... ... @@ -40,7 +43,7 @@ Page({
40 43 getUserID: d.user_id,
41 44 })
42 45  
43   - if(options.lbId) th.data.lbId=options.lbId;
  46 + if (options.lbId) th.data.lbId = options.lbId;
44 47 //-- 获取分享人的ID --
45 48 var first_leader = options.first_leader || getApp().globalData.first_leader;
46 49 if (first_leader) {
... ... @@ -62,6 +65,10 @@ Page({
62 65 onShow: function () {
63 66 //--先判断会员状态--
64 67 var user_info = getApp().globalData.userInfo;
  68 +
  69 + if(!getApp().is_Single_page()){
  70 + return false;
  71 + }
65 72 if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
66 73 getApp().goto('/pages/togoin/togoin');
67 74 return false;
... ... @@ -415,13 +422,13 @@ Page({
415 422 if (pagePath.indexOf('/') != 0) {
416 423 pagePath = '/' + pagePath;
417 424 }
418   - pagePath += "?isBuy=1" + "&lbId=" + this.data.getGiftID + "&first_leader="+ this.data.getUserID;
  425 + pagePath += "?isBuy=1" + "&lbId=" + this.data.getGiftID + "&first_leader=" + this.data.getUserID;
419 426 // if (this.data.isBuy == 0) {
420 427 // pagePath += "&orderSn=" + this.data.orderSn;
421 428 // } else {
422 429 // pagePath += "&lbId=" + this.data.getGiftID;
423 430 // }
424   - // console.log('pagePath', pagePath);
  431 + // console.log('pagePath', pagePath);
425 432 return {
426 433 title: "礼包详情",
427 434 path: pagePath,
... ... @@ -437,12 +444,13 @@ Page({
437 444 if (pagePath.indexOf('/') != 0) {
438 445 pagePath = '/' + pagePath;
439 446 }
440   - pagePath += "?isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader="+ this.data.getUserID;
  447 + pagePath += "?isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader=" + this.data.getUserID;
441 448 // if (this.data.isBuy == 0) {
442 449 // pagePath += "&orderSn=" + this.data.orderSn;
443 450 // } else {
444 451 // pagePath += "&lbId=" + this.data.getGiftID;
445 452 // }
  453 + console.log('pagePath', pagePath);
446 454 return {
447 455 title: "礼包详情",
448 456 path: pagePath,
... ... @@ -496,7 +504,7 @@ Page({
496 504 getApp().my_warnning(res.data.msg, 0, th);
497 505 }
498 506 },
499   - function (res) {}
  507 + function (res) { }
500 508  
501 509 )
502 510 })
... ...
pages/giftpack/mygiftpack/mygiftpack.js
... ... @@ -30,6 +30,9 @@ Page({
30 30 },
31 31  
32 32 onLoad: function(options) {
  33 + if(!getApp().is_Single_page()){
  34 + return false;
  35 + }
33 36 var th = this;
34 37 th.setData({
35 38 getStorageID: a.stoid,
... ...
pages/goods/categoryList/categoryList.js
... ... @@ -93,6 +93,9 @@ Page({
93 93  
94 94  
95 95 onLoad: function(tt) {
  96 + if(!getApp().is_Single_page()){
  97 + return false;
  98 + }
96 99 var that = this;
97 100 var first_leader=tt.first_leader;
98 101 if(first_leader){
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -25,7 +25,7 @@ Page({
25 25 color_type: 0, //线条控制
26 26 color_type_one: 0,
27 27 color_type_two: 1,
28   -
  28 + is_no_plus:1,
29 29 gid: "",
30 30 stoid: o.stoid,
31 31 url: o.url,
... ... @@ -255,6 +255,9 @@ Page({
255 255  
256 256 //------初始化加载----------
257 257 onLoad: function (t) {
  258 + if(!getApp().is_Single_page()){
  259 + return false;
  260 + }
258 261 var ee = this,
259 262 that = ee,
260 263 th = ee,
... ... @@ -354,6 +357,22 @@ Page({
354 357 th.data.c_guide_id = c_guide_id;
355 358 }
356 359  
  360 + //调用接口判断商家plus有没有过期
  361 + i.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => {
  362 + if (res.data.code == 0) {
  363 + var arr = res.data.data.pageData;
  364 + if (arr.length > 0) {
  365 + var item = arr[0];
  366 + if (item.is_sy == 0) {
  367 + var now = Date.parse(new Date()); now = now / 1000;
  368 + if (item.end_time < now) {
  369 + th.setData({ is_no_plus: 0 })
  370 + }
  371 + }
  372 + }
  373 + }
  374 + })
  375 +
357 376 getApp().getConfig(function (e) {
358 377 ee.setData({sto_sele_name_1: e.store_name})
359 378 })
... ... @@ -3526,6 +3545,7 @@ Page({
3526 3545  
3527 3546 //---判断拼单----
3528 3547 if (prom_type == 6) {
  3548 + console.log('判断拼单');
3529 3549 //-------判断活动是否抢光---------
3530 3550 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, {
3531 3551 1: 1
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -324,7 +324,7 @@
324 324 </view>
325 325 <!-- 不是秒杀 -->
326 326 <!-- 等级卡的价格,不是等级卡会员,且商品又有设置等级级价,商家后台有开通升级卡同能 -->
327   - <view class="flex ai_and" wx:if="{{!card_field && g_filters.is_has_rank(rank_switch,data) && prom_type!=1 && prom_type!=2 && prom_type!=4 && card_list && card_list.length>0 && g_filters.get_card_price(data,card_list,1)!=''}}">
  327 + <view class="flex ai_and" wx:if="{{!card_field && is_no_plus && g_filters.is_has_rank(rank_switch,data) && prom_type!=1 && prom_type!=2 && prom_type!=4 && card_list && card_list.length>0 && g_filters.get_card_price(data,card_list,1)!=''}}">
328 328 <view class="flex ai-center grade-card-frame card-frame">
329 329 <image class="img" src="{{iurl}}/miniapp/images/userinfo/userinfo/privilege_t.png"></image>
330 330 <view class="fs24 white view card-name ellipsis-1">
... ... @@ -336,7 +336,7 @@
336 336 </view>
337 337 </view>
338 338 <!-- 等级卡的显示,购买, 等级卡近30天要显示续费 -->
339   - <block wx:if="{{g_filters.is_has_rank(rank_switch,data)}}">
  339 + <block wx:if="{{g_filters.is_has_rank(rank_switch,data) && is_no_plus}}">
340 340 <!-- 不是秒杀,且会员不是等级会员 -->
341 341 <view wx:if="{{!card_field && prom_type!=1 && prom_type!=2 && card_list && card_list.length>0 && g_filters.get_card_price(data,card_list,1)!=''}}">
342 342 <view class="beauty-makeup-frame flex ai-center">
... ...
pages/goods/search/search.js
1   -var t = function(t) {
  1 +var t = function (t) {
2 2 return t && t.__esModule ? t : {
3 3 default: t
4 4 };
5 5 }(require("../../../utils/LoadMore.js")), ut = require("../../../utils/util.js"),
6   - a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting;
  6 + a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting;
7 7  
8 8 Page({
9 9 data: {
... ... @@ -18,143 +18,157 @@ Page({
18 18 requestUrl: "",
19 19 //hotWords: [ [ "手机", "小米", "iphone" ], [ "三星", "华为", "冰箱" ] ]
20 20 hotWords: null,
21   -
  21 + is_no_plus:1,
22 22 tabname: "sort", //排序的字段
23 23 adname: "asc", //升降的字段
24   - rq_data:null,
25   -
26   -
27   - searchRecord: [],
28   - keyword: '',
29   - is_his:0,
  24 + rq_data: null,
  25 + searchRecord: [],
  26 + keyword: '',
  27 + is_his: 0,
30 28 },
31   -
32   - onLoad: function(t) {
33   - this.data.rq_data=t;
  29 +
  30 + onLoad: function (t) {
  31 + this.data.rq_data = t;
34 32 //接受有没有导购的参数
35   - var first_leader=t.first_leader;
36   - if(first_leader){
37   - getApp().globalData.first_leader=first_leader;
  33 + var first_leader = t.first_leader;
  34 + if (first_leader) {
  35 + getApp().globalData.first_leader = first_leader;
38 36 //调用接口判断是不是会员
39   - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{
40   - if(res.data.code==0){
41   - getApp().globalData.guide_id=res.data.data.id;
  37 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => {
  38 + if (res.data.code == 0) {
  39 + getApp().globalData.guide_id = res.data.data.id;
42 40 }
43 41 })
44 42 }
45   -
46   - var th=this;
47   - a.getConfig2(function(rs){
48   - var arr=new Array(),arr2=new Array();
49   - if (rs.hot_keywords != null && ut.trim(rs.hot_keywords)!="" ){
50   - var arr1 = rs.hot_keywords.split('|');
51   - for (var i = 0; i < arr1.length;i++){
52   - if(i%5==0 && i!=0){
53   - arr.push(arr2);
54   - arr2=[];
55   - }else{
56   - arr2.push(arr1[i]);
  43 + var th = this;
  44 + //调用接口判断商家plus有没有过期
  45 + rq.promiseGet("/store/storemoduleendtime/page?store_id=" + oo.stoid + "&type=3", {}).then(res => {
  46 + if (res.data.code == 0) {
  47 + var arr = res.data.data.pageData;
  48 + if (arr.length > 0) {
  49 + var item = arr[0];
  50 + if (item.is_sy == 0) {
  51 + var now = Date.parse(new Date()); now = now / 1000;
  52 + if (item.end_time < now) {
  53 + th.setData({ is_no_plus: 0 })
  54 + }
  55 + }
57 56 }
58 57 }
59   - if (arr2.length > 0) arr.push(arr2);
60   - th.setData({ hotWords: arr});
61   - }
62   -
63   -
64   - //计算等级价相关
65   - var swithc_list=rs.switch_list;
66   - var sw_arr=JSON.parse(swithc_list);
67   - //---如果后台又开等级卡的开关---
68   - if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){
69   - th.setData({rank_switch:true});
70   - var user=getApp().globalData.userInfo;
71   - var ti=setInterval(function(){
72   - if(!user) return false;
73   - clearInterval(ti);
74   - //---回调卡的列表---
75   - th.getPlusCardType(function(ob){
76   - th.setData({card_list:ob.card_list});
77   - if(user.card_field ){
78   - var str = user['card_expiredate'].replace(/-/g, '/');
79   - var end = new Date(str);
80   - end = Date.parse(end) / 1000;
81   - var now = ut.gettimestamp();
82   -
83   - //--- 判断是等级会员,且在有效期范围内 ---
84   - if(user.card_field && now<end){
85   - var card_name=ob.name_map.get(user.card_field);
86   - if(card_name.length>7) card_name=card_name.substring(0,8);
87   - th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list});
88   - }
89   - }
90   - })
91   - },500)
92   - }
93   -
94   -
95   -
96   - })
97   - //e.init(this, "", "requestData");
98   - var url = this.data.baseUrl;
99   -
100   - //扫一扫过来,显示搜索的内容
101   - var s_key = t.s_key;
102   - if (s_key){
103   - s_key=s_key.trim();
104   - this.search(s_key); this.openSearchModal();
105   - return;
106   - }
107   -
108   - if (0 != t.brand_id && t.brand_id!=undefined){ url += "&brand_id=" + t.brand_id;}
109   - if (0 != t.nation_id && t.nation_id!=undefined) { url += "&nation_id=" + t.nation_id;}
110   - if (0 != t.max_price && t.max_price!=undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price;}
111   - if (0 != t.ladder_id && t.ladder_id != undefined) {
112   - url += "&ladder_id=" + t.ladder_id;
113   - this.setData({
114   - baseUrl:url,
  58 + })
  59 + a.getConfig2(function (rs) {
  60 + console.log('getConfig2', rs);
  61 + var arr = new Array(), arr2 = new Array();
  62 + if (rs.hot_keywords != null && ut.trim(rs.hot_keywords) != "") {
  63 + var arr1 = rs.hot_keywords.split('|');
  64 + for (var i = 0; i < arr1.length; i++) {
  65 + if (i % 5 == 0 && i != 0) {
  66 + arr.push(arr2);
  67 + arr2 = [];
  68 + } else {
  69 + arr2.push(arr1[i]);
  70 + }
  71 + }
  72 + if (arr2.length > 0) arr.push(arr2);
  73 + th.setData({ hotWords: arr });
  74 + }
  75 +
  76 +
  77 + //计算等级价相关
  78 + var swithc_list = rs.switch_list;
  79 + var sw_arr = JSON.parse(swithc_list);
  80 + console.log('sw_arr', sw_arr);
  81 + //---如果后台又开等级卡的开关---
  82 + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
  83 + th.setData({ rank_switch: true });
  84 + var user = getApp().globalData.userInfo;
  85 + var ti = setInterval(function () {
  86 + if (!user) return false;
  87 + clearInterval(ti);
  88 + //---回调卡的列表---
  89 + th.getPlusCardType(function (ob) {
  90 + th.setData({ card_list: ob.card_list });
  91 + if (user.card_field) {
  92 + var str = user['card_expiredate'].replace(/-/g, '/');
  93 + var end = new Date(str);
  94 + end = Date.parse(end) / 1000;
  95 + var now = ut.gettimestamp();
  96 +
  97 + //--- 判断是等级会员,且在有效期范围内 ---
  98 + if (user.card_field && now < end) {
  99 + var card_name = ob.name_map.get(user.card_field);
  100 + if (card_name.length > 7) card_name = card_name.substring(0, 8);
  101 + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
  102 + }
  103 + }
  104 + })
  105 + }, 500)
  106 + }
  107 +
  108 +
115 109  
116 110 })
117   - }
118   - if (url != this.data.baseUrl) return this.requestSearch(url);
119   - this.openSearchModal();
  111 + //e.init(this, "", "requestData");
  112 + var url = this.data.baseUrl;
  113 +
  114 + //扫一扫过来,显示搜索的内容
  115 + var s_key = t.s_key;
  116 + if (s_key) {
  117 + s_key = s_key.trim();
  118 + this.search(s_key); this.openSearchModal();
  119 + return;
  120 + }
  121 +
  122 + if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; }
  123 + if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; }
  124 + if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; }
  125 + if (0 != t.ladder_id && t.ladder_id != undefined) {
  126 + url += "&ladder_id=" + t.ladder_id;
  127 + this.setData({
  128 + baseUrl: url,
  129 +
  130 + })
  131 + }
  132 + if (url != this.data.baseUrl) return this.requestSearch(url);
  133 + this.openSearchModal();
120 134 // 获取历史搜索记录
121   - this.getHistorySearch();
  135 + this.getHistorySearch();
122 136 },
123   - changeTab: function(t) {
124   - var ord = t.currentTarget.dataset.href;
125   - var ad = t.currentTarget.dataset.ad;
  137 + changeTab: function (t) {
  138 + var ord = t.currentTarget.dataset.href;
  139 + var ad = t.currentTarget.dataset.ad;
126 140  
127   - var url = this.data.requestUrl;
  141 + var url = this.data.requestUrl;
128 142  
129   - if (this.data.tabname != ord) {
130   - this.setData({ tabname: ord, adname: "desc" });
131   - } else {
132   - ad = ad == "desc" ? "asc" : "desc";
133   - this.setData({ adname: ad });
134   - }
135   - this.resetData(), this.requestSearch(url);
  143 + if (this.data.tabname != ord) {
  144 + this.setData({ tabname: ord, adname: "desc" });
  145 + } else {
  146 + ad = ad == "desc" ? "asc" : "desc";
  147 + this.setData({ adname: ad });
  148 + }
  149 + this.resetData(), this.requestSearch(url);
136 150  
137 151 },
138 152  
139 153 //-----------真的调用地址进行搜索------------
140   - requestSearch: function(t) {
141   - if(this.data.loading) return false;
142   - this.data.loading=1;
143   - var e = this,th=e;
144   - if(getApp().globalData.userInfo){
145   - t += "&user_id=" + getApp().globalData.userInfo.user_id;
146   - }
  154 + requestSearch: function (t) {
  155 + if (this.data.loading) return false;
  156 + this.data.loading = 1;
  157 + var e = this, th = e;
  158 + if (getApp().globalData.userInfo) {
  159 + t += "&user_id=" + getApp().globalData.userInfo.user_id;
  160 + }
147 161 this.data.requestUrl = t;
148 162  
149   - var user_id=getApp().globalData.user_id;
150   - if(!user_id) user_id=0;
  163 + var user_id = getApp().globalData.user_id;
  164 + if (!user_id) user_id = 0;
151 165  
152   - 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=>{
153   - th.data.loading=0;
154   - if(ut.ajax_ok(res)){
155   - if(!e.data.requestData) e.data.requestData=[];
156   - for(let i in res.data.data.pageData){
157   - let item=res.data.data.pageData[i];
  166 + 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 => {
  167 + th.data.loading = 0;
  168 + if (ut.ajax_ok(res)) {
  169 + if (!e.data.requestData) e.data.requestData = [];
  170 + for (let i in res.data.data.pageData) {
  171 + let item = res.data.data.pageData[i];
158 172 item.original_img = th.data.url + item.original_img;
159 173  
160 174 /*--
... ... @@ -171,48 +185,48 @@ Page({
171 185 })--*/
172 186  
173 187 var prom_type = item.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购
174   - var prom_id=item.prom_id;
175   - var now=ut.gettimestamp();
  188 + var prom_id = item.prom_id;
  189 + var now = ut.gettimestamp();
176 190 var url = "";
177   - switch (prom_type){
  191 + switch (prom_type) {
178 192 case 1:
179   - url = "/api/ms/flash_sale/getNew/" +oo.stoid + "/" +user_id+"/"+ prom_id;
  193 + url = "/api/ms/flash_sale/getNew/" + oo.stoid + "/" + user_id + "/" + prom_id;
180 194 break;
181 195 case 2:
182   - url ="/api/weshop/goods/groupBuy/getActInfo/" +oo.stoid + "/" +item.goods_id+"/"+ prom_id
  196 + url = "/api/weshop/goods/groupBuy/getActInfo/" + oo.stoid + "/" + item.goods_id + "/" + prom_id
183 197 break;
184 198 case 4:
185   - url ="/api/weshop/integralbuy/get/"+oo.stoid +"/"+prom_id;
  199 + url = "/api/weshop/integralbuy/get/" + oo.stoid + "/" + prom_id;
186 200 break;
187 201 case 6:
188 202 url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id;
189   - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{
190   - data:{
191   - store_id: oo.stoid,
192   - is_end: 0,
193   - is_show: 1,
194   - user_id: getApp().globalData.user_id,
195   - pageSize:1000,
  203 + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1", {
  204 + data: {
  205 + store_id: oo.stoid,
  206 + is_end: 0,
  207 + is_show: 1,
  208 + user_id: getApp().globalData.user_id,
  209 + pageSize: 1000,
196 210 }
197   - }).then(pd=>{
198   - let pd_list=pd.data.data.pageData;
199   - if(res.data.code==0 && pd_list.length>0){
200   - var flag = pd_list.some(pd=>{
201   - return pd.goods_id==item.goods_id
202   - })
203   -
204   - if(!flag){
205   - item.prom_type=0;
206   - item.prom_id=0;
207   - item.prom_price=null;
208   - }
  211 + }).then(pd => {
  212 + let pd_list = pd.data.data.pageData;
  213 + if (res.data.code == 0 && pd_list.length > 0) {
  214 + var flag = pd_list.some(pd => {
  215 + return pd.goods_id == item.goods_id
  216 + })
  217 +
  218 + if (!flag) {
  219 + item.prom_type = 0;
  220 + item.prom_id = 0;
  221 + item.prom_price = null;
  222 + }
209 223 }
210   - })
  224 + })
211 225 break;
212 226 case 8:
213 227 var presell_id = prom_id;
214 228 var url1 = "/api/weshop/marketing/marketingPresellList/list";
215   - var rd= {
  229 + var rd = {
216 230 store_id: oo.stoid,
217 231 presell_id: presell_id,
218 232 goods_id: item.goods_id
... ... @@ -224,247 +238,247 @@ Page({
224 238 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
225 239 var arr = res.data.data[0];
226 240 item.prom_price = arr.luck_goods_price;
227   - item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0);
  241 + item.sales_sum = arr.buy_goodnum + (arr.virtual_qty ? arr.virtual_qty : 0);
228 242 }
229 243 })
230 244 break;
231 245 default:
232 246 break
233 247 }
234   - if(url!=null && url!=''){
  248 + if (url != null && url != '') {
235 249 await getApp().request.promiseGet(url, {}).then(async res => {
236   - var prom =null;
237   - if(res.data.code==0 && res.data.data){
238   - prom=res.data.data;
  250 + var prom = null;
  251 + if (res.data.code == 0 && res.data.data) {
  252 + prom = res.data.data;
239 253  
240   - if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time<now || (prom.show_time && prom.show_time<now)) ) {
  254 + if (prom != null && prom.is_end == 0 && prom.end_time > now && (prom.start_time < now || (prom.show_time && prom.show_time < now))) {
241 255 item.prom_price = res.data.data.price;
242   - if(res.data.data.user_price) item.prom_price=res.data.data.user_price;
243   - var vNum=prom.virtual_num?prom.virtual_num:0;
244   - var vNum1=prom.virtualNum?prom.virtualNum:0;
245   - var vNum2=prom.virtual?prom.virtual:0;
246   - item.sales_sum=prom.buy_num+(vNum+vNum1+vNum2);
247   - }else{
248   - item.prom_type=0;
249   - item.prom_id=0;
250   - item.prom_price=null;
  256 + if (res.data.data.user_price) item.prom_price = res.data.data.user_price;
  257 + var vNum = prom.virtual_num ? prom.virtual_num : 0;
  258 + var vNum1 = prom.virtualNum ? prom.virtualNum : 0;
  259 + var vNum2 = prom.virtual ? prom.virtual : 0;
  260 + item.sales_sum = prom.buy_num + (vNum + vNum1 + vNum2);
  261 + } else {
  262 + item.prom_type = 0;
  263 + item.prom_id = 0;
  264 + item.prom_price = null;
251 265 }
252 266  
253 267  
254 268 }
255 269 })
256 270 }
257   - if(!th.data.requestData) th.data.requestData=[];
  271 + if (!th.data.requestData) th.data.requestData = [];
258 272 th.data.requestData.push(item);
259   - e.setData({requestData: e.data.requestData});
  273 + e.setData({ requestData: e.data.requestData });
260 274 }
261 275 }
262 276 e.closeSearchModal();
263 277 })
264 278 },
265   - onReachBottom: function() {
  279 + onReachBottom: function () {
266 280 this.data.currentPage++
267 281 this.data.openSearchModal || e.canloadMore() && this.requestSearch(this.data.requestUrl);
268 282 },
269   - openFilterModal: function() {
  283 + openFilterModal: function () {
270 284 this.setData({
271 285 openFilterModal: !0
272 286 });
273 287 },
274   - closeFilterModal: function() {
  288 + closeFilterModal: function () {
275 289 this.setData({
276 290 openFilterModal: !1
277 291 });
278 292 },
279   - filterGoods: function(t) {
  293 + filterGoods: function (t) {
280 294 this.resetData(), this.requestSearch(t.currentTarget.dataset.href), this.closeFilterModal();
281 295 },
282   - resetData: function() {
  296 + resetData: function () {
283 297 e.resetConfig(), this.data.requestData = null, this.data.currentPage = 1;
284 298 },
285 299  
286 300 //---回复最初的设置---显示全部分类--
287   - restoreData: function() {
  301 + restoreData: function () {
288 302 this.setData({
289 303 requestData: this.data.allData,
290 304 });
291   - this.data.currentPage=2;
  305 + this.data.currentPage = 2;
292 306 },
293   - openSearchModal: function() {
  307 + openSearchModal: function () {
294 308 this.setData({
295 309 openSearchModal: !0
296 310 });
297 311 },
298   - closeSearchModal: function() {
  312 + closeSearchModal: function () {
299 313 this.setData({
300 314 openSearchModal: !1
301 315 });
302 316 },
303   - submitSearch: function(t) {
304   - console.log(111,t);
305   - var val=t.detail.value.word;
306   - if(val==undefined) val=t.detail.value;
307   - val=val?val.trim():'';
308   - if(!val){
309   - a.showWarning("请输入搜索关键词");
310   - }
  317 + submitSearch: function (t) {
  318 + console.log(111, t);
  319 + var val = t.detail.value.word;
  320 + if (val == undefined) val = t.detail.value;
  321 + val = val ? val.trim() : '';
  322 + if (!val) {
  323 + a.showWarning("请输入搜索关键词");
  324 + }
311 325 this.search(val);
312   -
  326 +
313 327 },
314 328  
315 329 //热搜关键字
316   - searchHotWord: function(t) {
317   -
318   - var word= t.currentTarget.dataset.word;
319   - this.historyRecord(word);
320   - this.search(word);
  330 + searchHotWord: function (t) {
  331 +
  332 + var word = t.currentTarget.dataset.word;
  333 + this.historyRecord(word);
  334 + this.search(word);
321 335 },
322 336  
323 337 //-----点击搜索按钮----
324   - search: function(t) {
  338 + search: function (t) {
325 339 if ("string" != typeof t || "" == t) return a.showWarning("请输入搜索关键词");
326   - this.data.key_str=t;
327   - this.historyRecord();
  340 + this.data.key_str = t;
  341 + this.historyRecord();
328 342 this.resetData(), this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t));
329 343 },
330 344  
331 345 //---------分享配置--------
332 346 onShareAppMessage: function (e) {
333   - var curPage=this;
  347 + var curPage = this;
334 348 var pagePath = curPage.route; //当前页面url
335 349 if (pagePath.indexOf('/') != 0) {
336 350 pagePath = '/' + pagePath;
337 351 }
338 352  
339   - if(this.data.key_str) {
  353 + if (this.data.key_str) {
340 354 pagePath += "?s_key=" + this.data.key_str;
341 355 }
342 356  
343   - if(getApp().globalData.user_id){
  357 + if (getApp().globalData.user_id) {
344 358  
345   - if(pagePath.indexOf("?")>0){
346   - pagePath+="&first_leader="+getApp().globalData.user_id;
347   - }else{
348   - pagePath+="?first_leader="+getApp().globalData.user_id;
  359 + if (pagePath.indexOf("?") > 0) {
  360 + pagePath += "&first_leader=" + getApp().globalData.user_id;
  361 + } else {
  362 + pagePath += "?first_leader=" + getApp().globalData.user_id;
349 363 }
350 364 }
351 365  
352   - console.log("11-11"+pagePath);
  366 + console.log("11-11" + pagePath);
353 367 return {
354 368 title: "商品搜索",
355   - path:pagePath,
  369 + path: pagePath,
356 370 }
357 371 },
358 372  
359 373  
360 374 //---------图片失败,默认图片--------
361 375 bind_bnerr: function (e) {
362   - var _errImg = e.target.dataset.errorimg;
363   - var _errObj = {};
364   - _errObj[_errImg] = this.data.url+ "/miniapp/images/default_g_img.gif";
365   - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  376 + var _errImg = e.target.dataset.errorimg;
  377 + var _errObj = {};
  378 + _errObj[_errImg] = this.data.url + "/miniapp/images/default_g_img.gif";
  379 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  380 + },
  381 +
  382 + //--- 获取卡类列表 ---
  383 + getPlusCardType: function (func) {
  384 + var storid = oo.stoid;
  385 + var th = this;
  386 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  387 + var plusCard = res.data.data;
  388 + var arr = [1219, 2089, 3031];
  389 + var new_arr = new Array();
  390 + var card_name_map = new Map();
  391 + var user = getApp().globalData.userInfo;
  392 +
  393 + for (var i = 0; i < plusCard.length; i++) {
  394 + if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) {
  395 + continue;
  396 + }
  397 + var name = "card" + plusCard[i].CorrPrice.toLowerCase();
  398 + card_name_map.set(name, plusCard[i].CardName);
  399 + new_arr.push(plusCard[i]);
  400 +
  401 + }
  402 +
  403 + var ob = { "card_list": new_arr, "name_map": card_name_map };
  404 + func(ob);
  405 + })
  406 + },
  407 +
  408 +
  409 + getInput(e) {
  410 + this.setData({
  411 + keyword: e.detail.value
  412 + });
  413 + },
  414 +
  415 + historyRecord(w) {
  416 + let keyword = w;
  417 + let self = this;
  418 + if (!keyword) {
  419 + keyword = this.data.key_str.trim();
  420 + }
  421 + let searchRecord = this.data.searchRecord;
  422 + if (!searchRecord || searchRecord.length == 0) searchRecord = wx.getStorageSync('searchRecord') || [];
  423 +
  424 + if (keyword) {
  425 +
  426 + var index = searchRecord.indexOf(keyword);
  427 + if (index > -1) {
  428 + // 已经存在该值
  429 + searchRecord.splice(index, 1);
  430 + searchRecord.unshift(keyword);
  431 +
  432 + // 将历史记录添加到缓存中
  433 + wx.setStorage({
  434 + key: 'searchRecord',
  435 + data: searchRecord,
  436 + success: function (res) {
  437 + self.setData({
  438 + searchRecord,
  439 + })
  440 + }
  441 + })
  442 +
  443 + return;
  444 + } else {
  445 + if (searchRecord.length >= 10) {
  446 + searchRecord.pop(); // 删除最早的一条记录
  447 + };
  448 + searchRecord.unshift(keyword);
  449 +
  450 + // // 将历史记录添加到缓存中
  451 + wx.setStorage({
  452 + key: 'searchRecord',
  453 + data: searchRecord,
  454 + success: function (res) {
  455 + self.setData({
  456 + searchRecord,
  457 + })
  458 + }
  459 + })
  460 + };
  461 + };
366 462 },
367   -
368   - //--- 获取卡类列表 ---
369   - getPlusCardType: function (func) {
370   - var storid = oo.stoid;
371   - var th = this;
372   - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
373   - var plusCard = res.data.data;
374   - var arr = [1219, 2089, 3031];
375   - var new_arr = new Array();
376   - var card_name_map=new Map();
377   - var user = getApp().globalData.userInfo;
378   -
379   - for (var i = 0; i < plusCard.length; i++) {
380   - if ((!user || user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) {
381   - continue;
382   - }
383   - var name="card"+plusCard[i].CorrPrice.toLowerCase();
384   - card_name_map.set(name,plusCard[i].CardName);
385   - new_arr.push(plusCard[i]);
386   -
387   - }
388   -
389   - var ob={"card_list":new_arr,"name_map":card_name_map};
390   - func(ob);
391   - })
392   - },
393   -
394   -
395   - getInput(e) {
396   - this.setData({
397   - keyword: e.detail.value
398   - });
399   - },
400   -
401   - historyRecord(w) {
402   - let keyword =w;
403   - let self = this;
404   - if(!keyword){
405   - keyword = this.data.key_str.trim();
406   - }
407   - let searchRecord = this.data.searchRecord;
408   - if(!searchRecord || searchRecord.length==0) searchRecord=wx.getStorageSync('searchRecord') || [];
409   -
410   - if(keyword) {
411   -
412   - var index=searchRecord.indexOf(keyword);
413   - if(index > -1) {
414   - // 已经存在该值
415   - searchRecord.splice(index,1);
416   - searchRecord.unshift(keyword);
417   -
418   - // 将历史记录添加到缓存中
419   - wx.setStorage({
420   - key: 'searchRecord',
421   - data: searchRecord,
422   - success: function(res) {
423   - self.setData({
424   - searchRecord,
425   - })
426   - }
427   - })
428   -
429   - return;
430   - } else {
431   - if(searchRecord.length >= 10) {
432   - searchRecord.pop(); // 删除最早的一条记录
433   - };
434   - searchRecord.unshift(keyword);
435   -
436   - // // 将历史记录添加到缓存中
437   - wx.setStorage({
438   - key: 'searchRecord',
439   - data: searchRecord,
440   - success: function(res) {
441   - self.setData({
442   - searchRecord,
443   - })
444   - }
445   - })
446   - };
447   - };
448   - },
449   -
450   -
451   -
452   -
453   - getHistorySearch() {
454   - this.setData({
455   - searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空
456   - });
457   - },
458   -
459   - clearSearchRecord() {
460   - wx.clearStorageSync('searchRecord');
461   - this.setData({
462   - searchRecord: []
463   - });
464   - },
465   -
466   - go_url:function (e) {
467   - var url=e.currentTarget.dataset.url;
  463 +
  464 +
  465 +
  466 +
  467 + getHistorySearch() {
  468 + this.setData({
  469 + searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空
  470 + });
  471 + },
  472 +
  473 + clearSearchRecord() {
  474 + wx.clearStorageSync('searchRecord');
  475 + this.setData({
  476 + searchRecord: []
  477 + });
  478 + },
  479 +
  480 + go_url: function (e) {
  481 + var url = e.currentTarget.dataset.url;
468 482 getApp().goto(url);
469 483 }
470 484 });
471 485 \ No newline at end of file
... ...
pages/goods/search/search.wxml
... ... @@ -38,10 +38,10 @@
38 38 <block wx:if="{{(item.prom_price>0 || item.prom_integral) && item.prom_id>0 && item.prom_type!=7}}">
39 39 <!-- 活动价 -->
40 40 <view class="price">
41   - <text wx:if="{{item.prom_integral}}">{{item.prom_integral}}积分</text>
42   - <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
43   - <text wx:if="{{item.prom_price}}">¥{{item.prom_price}}</text>
44   - </view>
  41 + <text wx:if="{{item.prom_integral}}">{{item.prom_integral}}积分</text>
  42 + <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
  43 + <text wx:if="{{item.prom_price}}">¥{{item.prom_price}}</text>
  44 + </view>
45 45 <view class="comment flex jc_sb">
46 46 <view class="word-line xc-ash">¥{{item.market_price}}</view>
47 47 <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
... ... @@ -49,7 +49,7 @@
49 49 </block>
50 50 <block wx:else>
51 51 <!-- 商品价格,先判断下是后又等级价-->
52   - <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
  52 + <block wx:if="{{g_filter.is_has_rank(rank_switch,item) && is_no_plus}}">
53 53 <!-- 当会员是等级卡的时候 -->
54 54 <block wx:if="{{card_field}}">
55 55 <!-- 等级价>0 -->
... ... @@ -57,9 +57,9 @@
57 57 <view class="flex ai_center">
58 58 <view class="price">¥{{item[card_field]}}</view>
59 59 <view class="card_bg flex ai-center">
60   - <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
61   - <!-- <view class="card_name ellipsis-1">{{card_name}}</view> -->
62   - <text class="ellipsis-1">{{card_name}}</text>
  60 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  61 + <!-- <view class="card_name ellipsis-1">{{card_name}}</view> -->
  62 + <text class="ellipsis-1">{{card_name}}</text>
63 63 </view>
64 64 </view>
65 65 <view class="comment flex jc_sb">
... ... @@ -85,10 +85,10 @@
85 85 <view class="flex ai_center">
86 86 <view class="">¥{{g_filter.get_card_price(item,card_list,0)}}</view>
87 87 <view class="card_bg flex">
88   - <view class="flex ai-center">
89   - <image src="{{url}}/miniapp/images/plus/dj_icon.png" class=""></image>
90   - <text class="ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text>
91   - </view>
  88 + <view class="flex ai-center">
  89 + <image src="{{url}}/miniapp/images/plus/dj_icon.png" class=""></image>
  90 + <text class="ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text>
  91 + </view>
92 92 </view>
93 93 </view>
94 94 <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
... ... @@ -120,7 +120,7 @@
120 120 <view class="no-data" wx:if="{{!requestData||requestData.length==0}}">
121 121 <image class="cart-image" src="{{url}}/miniapp/images/cart-null.png"></image>
122 122 <view class="no-data-title">没有相关的数据</view>
123   - <navigator bindtap="go_url" class="lookat" data-url="/pages/index/index/index"> 去逛逛 </navigator>
  123 + <navigator bindtap="go_url" class="lookat" data-url="/pages/index/index/index"> 去逛逛 </navigator>
124 124 </view>
125 125 </view>
126 126 <view hidden="{{!openFilterModal}}">
... ... @@ -176,17 +176,17 @@
176 176 </view>
177 177 </block>
178 178 </view>
179   - <view class="search-hot">
180   - <view class="hot-title flex jc_sb ai_c">
181   - <text>历史搜索</text>
182   - <text class="iconfont icon-shanchu xc-ash" bindtap="clearSearchRecord" wx:if="{{searchRecord.length != 0}}"></text>
183   - </view>
184   - <block wx:if="{{searchRecord.length>0}}">
185   - <view class="hot-row flex flex-wrap" wx:key="{{index}}">
186   - <view class="hot-item history ellipsis-1" bindtap="searchHotWord" data-word="{{item}}" wx:for="{{searchRecord}}" wx:key="{{index}}">{{item}}</view>
187   - </view>
188   - </block>
189   - <view wx:else class="fs24">暂无历史搜索记录</view>
190   - </view>
  179 + <view class="search-hot">
  180 + <view class="hot-title flex jc_sb ai_c">
  181 + <text>历史搜索</text>
  182 + <text class="iconfont icon-shanchu xc-ash" bindtap="clearSearchRecord" wx:if="{{searchRecord.length != 0}}"></text>
  183 + </view>
  184 + <block wx:if="{{searchRecord.length>0}}">
  185 + <view class="hot-row flex flex-wrap" wx:key="{{index}}">
  186 + <view class="hot-item history ellipsis-1" bindtap="searchHotWord" data-word="{{item}}" wx:for="{{searchRecord}}" wx:key="{{index}}">{{item}}</view>
  187 + </view>
  188 + </block>
  189 + <view wx:else class="fs24">暂无历史搜索记录</view>
  190 + </view>
191 191 </view>
192 192 </view>
193 193 \ No newline at end of file
... ...
pages/index/index/index.js
... ... @@ -88,7 +88,9 @@ Page({
88 88 },
89 89  
90 90 onLoad: async function (tt) {
91   -
  91 + if(!getApp().is_Single_page()){
  92 + return false;
  93 + }
92 94 var th = this;
93 95 var first_leader = tt.first_leader;
94 96 if (!first_leader && tt.scene) {
... ...
pages/template/index.js
... ... @@ -15,6 +15,9 @@ Page({
15 15 },
16 16  
17 17 onLoad: function(e) {
  18 + if(!getApp().is_Single_page()){
  19 + return false;
  20 + }
18 21 var th = this;
19 22 this.data.temp_id=e.scene;
20 23 if(!this.data.temp_id)
... ...
pages/user/Detailed/Detailed.js
... ... @@ -189,9 +189,10 @@ Page({
189 189 }
190 190  
191 191 this.data.is_loading=1;
192   - wx.showLoading({ title: '生成中...',})
193   -
194   - var th = this;
  192 + wx.showLoading({ title: '生成中...',})
  193 + this.setData({ canvasHidden: false })
  194 +
  195 + var th = this;
195 196  
196 197 //设置画板显示,才能开始绘图
197 198 var card_ming=th.data.bas_ming;//卡的图片
... ... @@ -217,7 +218,7 @@ Page({
217 218 success: function (res) {
218 219 th.get_head_temp(function(){
219 220 var vpath=res.path;
220   - th.setData({ canvasHidden: false })
  221 +
221 222 //开启画布
222 223 const ctx = wx.createCanvasContext('myCanvas');
223 224 //先画背景
... ...
pages/user/assistance/assistance.js
... ... @@ -39,7 +39,9 @@ Page({
39 39 * 生命周期函数--监听页面加载
40 40 */
41 41 onLoad: function(options) {
42   -
  42 + if(!getApp().is_Single_page()){
  43 + return false;
  44 + }
43 45 var th = this;
44 46 var nav_b = th.selectComponent("#nav_b"); //组件的id
45 47 nav_b.set_name("助力", "/pages/user/assistance/assistance");
... ...
pages/user/my_service/i_service.wxml
... ... @@ -99,4 +99,4 @@
99 99 <my_confirm id="my_confirm"></my_confirm>
100 100  
101 101 <!-- 批量预约图标 -->
102   -<view class="icon-container" bindtap="goto" data-url="/packageA/pages/my_service2/appment_main" ><text class="iconfont icon-plyy"></text></view>
103 102 \ No newline at end of file
  103 +<view class="icon-container" bindtap="goto" data-url="/packageA/pages/my_service2/appment_main" hidden><text class="iconfont icon-plyy"></text></view>
104 104 \ No newline at end of file
... ...