Commit bae40a292fd5fd5b8a480813fae25c6369492280
Merge branch 'qa' of http://git.vipzhuang.cn/wxd/MShopWeApp
# Conflicts: # app.js
Showing
9 changed files
with
453 additions
and
15 deletions
app.js
0 → 100644
| 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; | |
| 3 | +var regeneratorRuntime = require('./utils/runtime.js'); | |
| 4 | +var api = require("./api/api.js") | |
| 5 | + | |
| 6 | +//公共方法和变量 | |
| 7 | +App({ | |
| 8 | + globalData: { | |
| 9 | + setting: t, | |
| 10 | + wechatUser: null, | |
| 11 | + userInfo: null, | |
| 12 | + config: null, //门店参数 | |
| 13 | + config2: null, //门店配置 | |
| 14 | + code: null, | |
| 15 | + heigth:0, | |
| 16 | + user_id:null,// 3674923,// 4379287,// null,// 5682068, | |
| 17 | + buy_now:null, | |
| 18 | + picklist:null, //门店列表 | |
| 19 | + wuliuprice: null, //物流价格表 | |
| 20 | + wuliu: null, //物流公司 | |
| 21 | + baddr:null, | |
| 22 | + mobile: null, //记录手机 | |
| 23 | + getu:null, //记录会员信息 | |
| 24 | + sessionKey: null,//记录会员信息 | |
| 25 | + openid: null, //记录会员信息 | |
| 26 | + | |
| 27 | + to_group:null, //参团传递的数据 | |
| 28 | + wxapp_buy_obj:null, //微信小程序购买的Object | |
| 29 | + pk_store:null, //选择的门店 | |
| 30 | + | |
| 31 | + }, | |
| 32 | + auth: o, | |
| 33 | + request: a, | |
| 34 | + onLaunch: function() { | |
| 35 | + this.initExt(); | |
| 36 | + var t = this.globalData.setting; | |
| 37 | + t.resourceUrl = t.url + "/template/mobile/rainbow"; | |
| 38 | + var clientWidth = wx.getSystemInfoSync().windowWidth; | |
| 39 | + var rpxR = 750 / clientWidth; | |
| 40 | + var calc = wx.getSystemInfoSync().windowHeight * rpxR; | |
| 41 | + this.globalData.heigth=calc; | |
| 42 | + | |
| 43 | + var app=this; | |
| 44 | + if(!app.globalData.userInfo){ | |
| 45 | + var user = wx.getStorageSync("userinfo"); | |
| 46 | + if (user && user.user_id){ | |
| 47 | + app.globalData.userInfo=wx.getStorageSync("userinfo"); | |
| 48 | + app.globalData.user_id= app.globalData.userInfo.user_id; | |
| 49 | + } | |
| 50 | + } | |
| 51 | + }, | |
| 52 | + | |
| 53 | + //---初始化第三方---- | |
| 54 | + initExt: function() { | |
| 55 | + var tt=t; | |
| 56 | + console.log("initExt"); | |
| 57 | + console.log(11); | |
| 58 | + var t = wx.getExtConfigSync(), o = this.globalData.setting; | |
| 59 | + console.log(t); | |
| 60 | + t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt=1; | |
| 61 | + | |
| 62 | + | |
| 63 | + }, | |
| 64 | + | |
| 65 | + //首页的第一次登录 | |
| 66 | + getUserFir(t){ | |
| 67 | + var s = this; | |
| 68 | + if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else { | |
| 69 | + if (!o.isAuth()) return o.wxLogin_fir(t); | |
| 70 | + if (null == s.globalData.userInfo) { | |
| 71 | + return o.wxLogin_fir(t); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + }, | |
| 75 | + | |
| 76 | + getUserInfo: function(t, n, i) { | |
| 77 | + var s = this; | |
| 78 | + if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else { | |
| 79 | + if (!o.isAuth()) return o.auth(t); | |
| 80 | + if (null == s.globalData.userInfo){ | |
| 81 | + return o.auth(t); | |
| 82 | + } | |
| 83 | + /*--- | |
| 84 | + a.get("/api/user/userInfo", { | |
| 85 | + isShowLoading: void 0 === i || i, | |
| 86 | + success: function(o) { | |
| 87 | + s.globalData.userInfo = o.data.result, s.globalData.userInfo.head_pic = e.getFullUrl(s.globalData.userInfo.head_pic), | |
| 88 | + "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); | |
| 89 | + } | |
| 90 | + });--*/ | |
| 91 | + } | |
| 92 | + }, | |
| 93 | + //----------------获取配置参数-------------------- | |
| 94 | + getConfig: function(t, o) { | |
| 95 | + var e = this; if(this.globalData.config==undefined) this.globalData.config=null; | |
| 96 | + this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.request.get("/api/weshop/store/get/" + e.globalData.setting.stoid, { | |
| 97 | + success: function(o) { | |
| 98 | + console.log('getConfig'); | |
| 99 | + if(o.data.code==0){ | |
| 100 | + e.globalData.config = o.data.data, "function" == typeof t && t(e.globalData.config); | |
| 101 | + } | |
| 102 | + } | |
| 103 | + }); | |
| 104 | + }, | |
| 105 | + | |
| 106 | + //----------------获取配置参数-------------------- | |
| 107 | + getConfig2: function (t, o) { | |
| 108 | + var e = this; | |
| 109 | + this.globalData.config2 && !o ? | |
| 110 | + "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, { | |
| 111 | + success: function (o) { | |
| 112 | + console.log('getConfig2'); | |
| 113 | + if (o.data.code == 0) { | |
| 114 | + e.globalData.config2 = o.data.data, "function" == typeof t && t(e.globalData.config2); | |
| 115 | + } | |
| 116 | + } | |
| 117 | + }); | |
| 118 | + }, | |
| 119 | + | |
| 120 | + //----------------获取商家开启的物流-------------------- | |
| 121 | + getwuliu: function (t, o){ | |
| 122 | + var th = this, st = this.globalData.setting; | |
| 123 | + this.globalData.wuliu && !o ? | |
| 124 | + "function" == typeof t && t(this.globalData.wuliu) : a.get("/api/weshop/storeshipping/list", { | |
| 125 | + data: { store_id: st.stoid, status: 1, pageSize:600 }, | |
| 126 | + success: function (o) { | |
| 127 | + console.log('getwuliu'); | |
| 128 | + console.log(o); | |
| 129 | + if (o.data.code == 0) { | |
| 130 | + var arr = o.data.data.pageData; | |
| 131 | + console.log(arr); | |
| 132 | + arr.forEach(function(item,index){ | |
| 133 | + arr[index].code = item.shipping_code; arr[index].name = item.shipping_name; | |
| 134 | + }) | |
| 135 | + th.globalData.wuliu = arr, "function" == typeof t && t(arr); | |
| 136 | + } | |
| 137 | + } | |
| 138 | + }); | |
| 139 | + }, | |
| 140 | + | |
| 141 | + //----------------获取物流价格表-------------------- | |
| 142 | + getwuliuprice: function (t, o) { | |
| 143 | + var e = this,th=e, st = this.globalData.setting; | |
| 144 | + this.globalData.wuliuprice && !o ? | |
| 145 | + "function" == typeof t && t(this.globalData.wuliuprice) : a.get("/api/weshop/shippingarea/list",{ | |
| 146 | + data: { store_id: st.stoid,pageSize: 600 }, | |
| 147 | + success: function (o) { | |
| 148 | + console.log('getwuliuprice'); | |
| 149 | + console.log(o); | |
| 150 | + if (o.data.code == 0) { | |
| 151 | + var arr=o.data.data.pageData; | |
| 152 | + console.log(arr); | |
| 153 | + if (arr.length>0){ | |
| 154 | + for (var i = 0; i < arr.length;i++){ | |
| 155 | + arr[i].code = arr[i].shipping_code; | |
| 156 | + if (arr[i].json_config != "" && arr[i].json_config != undefined && arr[i].json_config != null ) | |
| 157 | + arr[i].config = JSON.parse(arr[i].json_config); | |
| 158 | + } | |
| 159 | + } | |
| 160 | + th.globalData.wuliuprice = o.data.data, "function" == typeof t && t(e.globalData.wuliuprice); | |
| 161 | + } | |
| 162 | + } | |
| 163 | + }); | |
| 164 | + }, | |
| 165 | + //----------------设置立即购买数组-------------------- | |
| 166 | + set_b_now: function (d) { this.globalData.buy_now=d;}, | |
| 167 | + get_b_now: function () {return this.globalData.buy_now}, | |
| 168 | + | |
| 169 | + getPrevPageData: function(t) { | |
| 170 | + void 0 === t && (t = 1); | |
| 171 | + var o = getCurrentPages(); | |
| 172 | + return o[o.length - t - 1].data; | |
| 173 | + }, | |
| 174 | + showLoading: function(t, o) { | |
| 175 | + void 0 === o && (o = 1500), wx.showToast({ | |
| 176 | + title: "加载中", | |
| 177 | + icon: "loading", | |
| 178 | + duration: o, | |
| 179 | + mask: !0, | |
| 180 | + complete: function() { | |
| 181 | + "function" == typeof t && setTimeout(t, o); | |
| 182 | + } | |
| 183 | + }); | |
| 184 | + }, | |
| 185 | + showSuccess: function(t, o, a) { | |
| 186 | + void 0 === a && (a = 1e3), wx.showToast({ | |
| 187 | + title: t, | |
| 188 | + icon: "success", | |
| 189 | + duration: a, | |
| 190 | + mask: !0, | |
| 191 | + complete: function() { | |
| 192 | + "function" == typeof o && setTimeout(o, a); | |
| 193 | + } | |
| 194 | + }); | |
| 195 | + }, | |
| 196 | + showWarning: function(t, o, a, e) { | |
| 197 | + //var imghost=this.globalData.setting.imghost; | |
| 198 | + !a && (a = 1500), void 0 === e && (e = !0), wx.showToast({ | |
| 199 | + title: t, | |
| 200 | + mask: e, | |
| 201 | + duration: a, | |
| 202 | + image:"/images/gt.png", | |
| 203 | + complete: function() { | |
| 204 | + "function" == typeof o && setTimeout(o, a); | |
| 205 | + } | |
| 206 | + }); | |
| 207 | + }, | |
| 208 | + | |
| 209 | + confirmBox: function(t, o) { | |
| 210 | + wx.showModal({ | |
| 211 | + title: t, | |
| 212 | + showCancel: !1, | |
| 213 | + complete: function() { | |
| 214 | + "function" == typeof o && o(); | |
| 215 | + } | |
| 216 | + }); | |
| 217 | + }, | |
| 218 | + | |
| 219 | + //----------获取所有的门店------------ | |
| 220 | + get_allsto(func){ | |
| 221 | + var th=this; | |
| 222 | + if (this.globalData.picklist!=null){ | |
| 223 | + "function" == typeof func && func(th.globalData.picklist); | |
| 224 | + }else{ | |
| 225 | + th.request.get("/api/weshop/pickup/page", { | |
| 226 | + data: { store_id: th.globalData.setting.stoid, pageSize: 600 }, | |
| 227 | + success: function (da) { | |
| 228 | + //设置门店 | |
| 229 | + //th.setData({ allsto: da.data.data.pageData }); | |
| 230 | + th.globalData.picklist = da.data.data.pageData; | |
| 231 | + "function" == typeof func && func(th.globalData.picklist); | |
| 232 | + } | |
| 233 | + }) | |
| 234 | + } | |
| 235 | + }, | |
| 236 | + | |
| 237 | + //同步化,在调用的时候要await | |
| 238 | + async get_isbuy() { | |
| 239 | + | |
| 240 | + var th=this; | |
| 241 | + await api.check_isbuy({ store_id: t.stoid, type: 5 }).then(res=>{ | |
| 242 | + var o=res; | |
| 243 | + if (o.data.code == 0) { | |
| 244 | + var ob = { isout: 0, isbuy: 1 }; | |
| 245 | + var arr = o.data.data.pageData; | |
| 246 | + var isbuy = 0; | |
| 247 | + //----如果数组不为空---- | |
| 248 | + if (arr.length > 0) { | |
| 249 | + arr.forEach(function (val, ind) { | |
| 250 | + if (val.is_sy == 0 && val.type == 5) { | |
| 251 | + isbuy = 1; | |
| 252 | + var now = ut.gettimestamp(); | |
| 253 | + if (now > val.end_time) ob.isout = 1; | |
| 254 | + return false; | |
| 255 | + } | |
| 256 | + }) | |
| 257 | + } | |
| 258 | + ob.isbuy = isbuy; | |
| 259 | + th.globalData.wxapp_buy_obj=ob; | |
| 260 | + } | |
| 261 | + }) | |
| 262 | + }, | |
| 263 | + | |
| 264 | + //--同步化,在调用的时候要await,获取商家config-- | |
| 265 | + async getConfig_ays(){ | |
| 266 | + if(this.globalData.config!=null) return false; | |
| 267 | + var th=this; | |
| 268 | + await api.get_config(this.globalData.setting.stoid).then(res=>{ | |
| 269 | + var o=res; | |
| 270 | + if(o.data.code==0){ | |
| 271 | + th.globalData.config = o.data.data; | |
| 272 | + } | |
| 273 | + }) | |
| 274 | + }, | |
| 275 | + | |
| 276 | + //----智能跳转,判断 非tabBar,tabBar页面的跳转---- | |
| 277 | + goto:function (url) { | |
| 278 | + var arr_tabbar=["/pages/index/index/index","/pages/goods/categoryList/categoryList", | |
| 279 | + "/pages/goods/categoryList/categoryList?type=2", | |
| 280 | + "/pages/goods/categoryList/categoryList?type=1", | |
| 281 | + "/pages/cart/cart/cart","/pages/user/index/index"]; | |
| 282 | + if(arr_tabbar.indexOf(url)!=-1){ | |
| 283 | + if(url.indexOf("categoryList?type=1")!=-1) this.globalData.cat_type=1; | |
| 284 | + if(url.indexOf("categoryList?type=2")!=-1) this.globalData.cat_type=2; | |
| 285 | + wx.switchTab({ url: url, }) //跳到tabbar页 | |
| 286 | + }else{ | |
| 287 | + wx.navigateTo({ url: url, }) //跳到非tabbar页 | |
| 288 | + } | |
| 289 | + }, | |
| 290 | + | |
| 291 | + //显示提示,word提示内容,type 0失败,提示 1成功 | |
| 292 | + my_warnning(word,type,that,width){ | |
| 293 | + var warn = that.selectComponent("#warn"); //组件的id | |
| 294 | + warn.open(word,type,width); | |
| 295 | + return 1; | |
| 296 | + }, | |
| 297 | + | |
| 298 | + //获取会员门店 | |
| 299 | + get_user_store:function (func) | |
| 300 | + { | |
| 301 | + var th=this; | |
| 302 | + this.getConfig2(function (conf) { | |
| 303 | + //---空会员的情况--- | |
| 304 | + if(!th.globalData.userInfo){ | |
| 305 | + return func(null); | |
| 306 | + } | |
| 307 | + if(!th.globalData.pk_store){ | |
| 308 | + var pick_id=0; | |
| 309 | + //先找一个会员是否有设置默认的地址 | |
| 310 | + if(th.globalData.userInfo.def_pickup_id){ | |
| 311 | + pick_id= th.globalData.userInfo.def_pickup_id | |
| 312 | + } | |
| 313 | + //查找会员的注册的地址 | |
| 314 | + else if(th.globalData.userInfo.pickup_id){ | |
| 315 | + //--购买门店是否默认登记门店-- | |
| 316 | + if(conf.switch_list){ | |
| 317 | + var t_swi=JSON.parse(conf.switch_list); | |
| 318 | + if(t_swi.is_regstores){ | |
| 319 | + pick_id= th.globalData.userInfo.pickup_id | |
| 320 | + } | |
| 321 | + } | |
| 322 | + | |
| 323 | + } | |
| 324 | + //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店-- | |
| 325 | + if(pick_id==0) return func(null); | |
| 326 | + //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭 | |
| 327 | + th.request.get("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{ | |
| 328 | + data:{}, | |
| 329 | + success:function (res) { | |
| 330 | + th.globalData.pk_store=null; | |
| 331 | + if(res.data.code==0 && res.data.data && res.data.data.isstop==0){ | |
| 332 | + if(res.data.data.category_id){ | |
| 333 | + th.request.get( "/api/weshop/storagecategory/get/"+os.stoid+"/"+res.data.data.category_id, { | |
| 334 | + data: {}, | |
| 335 | + success: function (ee) { | |
| 336 | + if(ee.data.code==0 && ee.data.data ){ | |
| 337 | + if(ee.data.data.is_show==1){ | |
| 338 | + th.globalData.pk_store = res.data.data; | |
| 339 | + func(th.globalData.pk_store); | |
| 340 | + }else{ | |
| 341 | + func(null); | |
| 342 | + } | |
| 343 | + }else{ | |
| 344 | + func(null); | |
| 345 | + } | |
| 346 | + } | |
| 347 | + }) | |
| 348 | + }else{ | |
| 349 | + th.globalData.pk_store = res.data.data; | |
| 350 | + func(th.globalData.pk_store); | |
| 351 | + } | |
| 352 | + }else{ | |
| 353 | + func(null); | |
| 354 | + } | |
| 355 | + } | |
| 356 | + }) | |
| 357 | + }else{ | |
| 358 | + func(th.globalData.pk_store); | |
| 359 | + } | |
| 360 | + }) | |
| 361 | + | |
| 362 | + }, | |
| 363 | + | |
| 364 | + //-------获取购物车数量---------- | |
| 365 | + requestCardNum: function() { | |
| 366 | + var th = this; | |
| 367 | + th.request.get("/api/weshop/cart/page", { | |
| 368 | + data: { | |
| 369 | + store_id: th.globalData.setting.stoid, | |
| 370 | + user_id: th.globalData.user_id, | |
| 371 | + }, | |
| 372 | + success: function(e) { | |
| 373 | + var num = 0; | |
| 374 | + for (var i = 0; i < e.data.data.pageData.length; i++) { | |
| 375 | + num += e.data.data.pageData[i].goods_num; | |
| 376 | + } | |
| 377 | + wx.setTabBarBadge({ //tabbar右上角添加文本 | |
| 378 | + index: 2, ////tabbar下标 | |
| 379 | + text: '' + num //显示的内容 | |
| 380 | + }); | |
| 381 | + } | |
| 382 | + }); | |
| 383 | + }, | |
| 384 | + | |
| 385 | + //------定时等待某个值,有值才进行运算-------- | |
| 386 | + waitfor:function(page,key,pop_value,func){ | |
| 387 | + var n=0; | |
| 388 | + if(!page.data[key]){ | |
| 389 | + page.data[key]=setInterval(function(){ | |
| 390 | + console.log(page.data[key]);n++; | |
| 391 | + if(pop_value) { | |
| 392 | + clearInterval(page.data[key]); | |
| 393 | + func(); | |
| 394 | + } | |
| 395 | + if(n>15) clearInterval(page.data[key]); | |
| 396 | + },1000); | |
| 397 | + } | |
| 398 | + }, | |
| 399 | + | |
| 400 | + | |
| 401 | + //------定时等待某个值,有值才进行运算-------- | |
| 402 | + waitfor2:function(page,key,pop_value_key,func){ | |
| 403 | + var n=0; | |
| 404 | + if(!page.data[key]){ | |
| 405 | + page.data[key]=setInterval(function(){ | |
| 406 | + console.log(page.data[key]);n++; | |
| 407 | + if(page.data[pop_value_key]) { | |
| 408 | + clearInterval(page.data[key]); | |
| 409 | + func(); | |
| 410 | + } | |
| 411 | + if(n>15){ | |
| 412 | + clearInterval(page.data[key]); | |
| 413 | + func(); | |
| 414 | + } | |
| 415 | + },1000); | |
| 416 | + } | |
| 417 | + } | |
| 418 | + | |
| 419 | + | |
| 420 | +}); | ... | ... |
pages/cart/cart/cart.js
| ... | ... | @@ -122,16 +122,27 @@ Page({ |
| 122 | 122 | store_id: oo.stoid, |
| 123 | 123 | pageSize: 600 |
| 124 | 124 | }, |
| 125 | - success: function(su) { | |
| 125 | + success:async function(su) { | |
| 126 | 126 | //按门店分类的数组 |
| 127 | 127 | var arr = new Array(), |
| 128 | 128 | carr = su.data.data.pageData; |
| 129 | 129 | var all_num = 0; |
| 130 | 130 | |
| 131 | 131 | for (var i = 0; i < carr.length; i++) { |
| 132 | - | |
| 133 | - | |
| 134 | 132 | var item = carr[i]; |
| 133 | + var good=null; | |
| 134 | + await getApp().request.promiseGet("/api/weshop/goods/get/"+os.stoid+"/"+item.goods_id,{}).then(res=>{ | |
| 135 | + good=res.data.data; | |
| 136 | + }) | |
| 137 | + var tt=ut.gettimestamp(); | |
| 138 | + if((good.down_time>0 && good.down_time<tt) || good.is_on_sale==0 ){ | |
| 139 | + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | |
| 140 | + a.delete(url, { | |
| 141 | + success: function(t) { } | |
| 142 | + }); | |
| 143 | + //商品已经下架 | |
| 144 | + continue; | |
| 145 | + } | |
| 135 | 146 | all_num += item.goods_num; |
| 136 | 147 | item.original_img = oo.imghost + item.original_img; |
| 137 | 148 | item.selected = 0; | ... | ... |
pages/giftpack/birthdaygift/birthdaygift.js
| ... | ... | @@ -140,7 +140,8 @@ Page({ |
| 140 | 140 | "actType": 4, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 |
| 141 | 141 | "giftBagId": th.data.giftID, //礼包Id |
| 142 | 142 | "storeId": a.stoid, //商家Id |
| 143 | - "userId": d.user_id //用户ID | |
| 143 | + "userId": d.user_id, //用户ID | |
| 144 | + "buyFrom": 2 | |
| 144 | 145 | }; |
| 145 | 146 | var data = JSON.stringify(json); |
| 146 | 147 | var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; | ... | ... |
pages/giftpack/evaluategift/evaluategift.js
| ... | ... | @@ -157,7 +157,8 @@ Page({ |
| 157 | 157 | "orderNumber": th.data.orderNumber, |
| 158 | 158 | "orderType": th.data.orderType, |
| 159 | 159 | "orderGoodsId": th.data.orderGoodsId, |
| 160 | - "giftBagId": th.data.giftBagId | |
| 160 | + "giftBagId": th.data.giftBagId, | |
| 161 | + "buyFrom": 2 | |
| 161 | 162 | }; |
| 162 | 163 | var data = JSON.stringify(json); |
| 163 | 164 | var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; | ... | ... |
pages/giftpack/festival/festival.js
| ... | ... | @@ -147,7 +147,8 @@ Page({ |
| 147 | 147 | "actType": 3, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 |
| 148 | 148 | "giftBagId": th.data.giftID, //礼包Id |
| 149 | 149 | "storeId": a.stoid, //商家Id |
| 150 | - "userId": d.user_id //用户ID | |
| 150 | + "userId": d.user_id, //用户ID | |
| 151 | + "buyFrom": 2 | |
| 151 | 152 | } |
| 152 | 153 | var data = JSON.stringify(json); |
| 153 | 154 | var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; | ... | ... |
pages/giftpack/newvipgift/newvipgift.js
| ... | ... | @@ -139,7 +139,8 @@ Page({ |
| 139 | 139 | "actType": 1, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 |
| 140 | 140 | "giftBagId": th.data.giftID, //礼包Id |
| 141 | 141 | "storeId": a.stoid, //商家Id |
| 142 | - "userId": d.user_id //用户ID | |
| 142 | + "userId": d.user_id, //用户ID | |
| 143 | + "buyFrom": 2 | |
| 143 | 144 | }; |
| 144 | 145 | var data = JSON.stringify(json); |
| 145 | 146 | var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
| ... | ... | @@ -341,7 +341,10 @@ Page({ |
| 341 | 341 | |
| 342 | 342 | //获取用户的默认门店 |
| 343 | 343 | getApp().get_user_store(function(ee) { |
| 344 | - if(!ee) return false; | |
| 344 | + if(!ee) { | |
| 345 | + th.data.fir_def_store={}; //赋值空对象 | |
| 346 | + return false; | |
| 347 | + } | |
| 345 | 348 | var appd=getApp().globalData; |
| 346 | 349 | var w_time = setInterval(function() { |
| 347 | 350 | if (that.data.is_get_local_ok == 0) return false; |
| ... | ... | @@ -631,7 +634,7 @@ Page({ |
| 631 | 634 | if(that.data.sales_rules==2 && that.data.is_newsales_rules){ |
| 632 | 635 | //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 |
| 633 | 636 | getApp().waitfor2(that,"wait_for_user_store","fir_def_store",function(){ |
| 634 | - if(th.data.fir_def_store){ | |
| 637 | + if(th.data.fir_def_store && th.data.fir_def_store.pickup_id ){ | |
| 635 | 638 | var lock=0,plist=null; |
| 636 | 639 | //先读取门店的lock,采用链式写法,少用await |
| 637 | 640 | getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ |
| ... | ... | @@ -1851,7 +1854,7 @@ Page({ |
| 1851 | 1854 | o_plist[kk].CanOutQty=n_item.CanOutQty-lock_num; |
| 1852 | 1855 | new_list.push(o_plist[kk]); |
| 1853 | 1856 | //如果找到默认门店 |
| 1854 | - if(n_item.StorageNo==th.data.fir_def_store.pickup_no){ | |
| 1857 | + if(th.data.fir_def_store && n_item.StorageNo==th.data.fir_def_store.pickup_no){ | |
| 1855 | 1858 | th.data.fir_def_store.CanOutQty=n_item.CanOutQty-lock_num; |
| 1856 | 1859 | if(def_pick_store.pickup_id==th.data.fir_def_store.pickup_id) |
| 1857 | 1860 | th.setData({def_pick_store:th.data.fir_def_store}) |
| ... | ... | @@ -1868,10 +1871,10 @@ Page({ |
| 1868 | 1871 | em.data.data.total=new_list.length; |
| 1869 | 1872 | em.data.data.pageData=new_list; |
| 1870 | 1873 | |
| 1871 | - if(th.data.fir_def_store && !is_find_def_store){ | |
| 1874 | + if(th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id){ | |
| 1872 | 1875 | th.data.fir_def_store.CanOutQty=0; |
| 1873 | 1876 | //--当选择的门店是客户默认的门店的时候-- |
| 1874 | - if(th.data.fir_def_store.pickup_id==th.data.def_pick_store.pickup_id) { | |
| 1877 | + if(th.data.def_pick_store && th.data.fir_def_store.pickup_id==th.data.def_pick_store.pickup_id) { | |
| 1875 | 1878 | th.setData({def_pick_store:th.data.fir_def_store}); |
| 1876 | 1879 | em.data.data.pageData.unshift(th.data.def_pick_store); |
| 1877 | 1880 | }else{ |
| ... | ... | @@ -3649,7 +3652,7 @@ Page({ |
| 3649 | 3652 | func(); return false; |
| 3650 | 3653 | } |
| 3651 | 3654 | |
| 3652 | - if(this.data.sales_rules!=2 && this.data.is_newsales_rules!=1){ | |
| 3655 | + if(this.data.sales_rules!=2){ | |
| 3653 | 3656 | func(); |
| 3654 | 3657 | }else{ |
| 3655 | 3658 | ... | ... |
pages/team/team_show/team_show.wxml
| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | </view> |
| 25 | 25 | <view class="xc-wc fs24"> |
| 26 | 26 | <view> |
| 27 | - <view class="">已拼{{teamlist.buy_num}}份</view> | |
| 27 | + <view class="">已拼{{teamlist.buy_num}}件</view> | |
| 28 | 28 | <view class="flex xc-valframe t-c"> |
| 29 | 29 | <view class="xc-frame-img"> |
| 30 | 30 | <image class="picture"src="{{imageurl}}/miniapp/images/bai-ren.png"></image> | ... | ... |
pages/team/team_success/team_success.wxml
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | </view> |
| 24 | 24 | <view class="xc-wc fs24"> |
| 25 | 25 | <view> |
| 26 | - <view class="">已拼{{teamlist.buy_num}}份</view> | |
| 26 | + <view class="">已拼{{teamlist.buy_num}}件</view> | |
| 27 | 27 | <view class="flex xc-valframe t-c"> |
| 28 | 28 | <view class="xc-frame-img"> |
| 29 | 29 | <image class="picture" src="{{iurl}}/miniapp/images/bai-ren.png"></image> | ... | ... |