diff --git a/app.js b/app.js index e30525f..e674963 100644 --- a/app.js +++ b/app.js @@ -135,6 +135,15 @@ App({ } }) } + + // else if(app.globalData.user_id){ //-- 启用默认的user_id -- + // app.promiseGet("/api/weshop/users/get/" + app.globalData.setting.stoid + "/" + app.globalData.user_id,{}).then(res=>{ + // if(res.data.code==0){ + // app.globalData.userInfo = res.data.data; + // wx.setStorageSync("userinfo",app.globalData.userInfo); + // } + // }) + // } } wx.getSystemInfo({ success: (res) => { @@ -989,7 +998,14 @@ App({ }; }, }); - }; + } + else{ + wx.showModal({ + content: '商家未设置客服热线', + showCancel: 0, + + }); + } }); }, @@ -1314,7 +1330,6 @@ App({ var stoid=this.globalData.setting.stoid; var user_id=this.globalData.user_id; - this.getConfig2(async function (e){ if(e && e.switch_list) conf=JSON.parse(e.switch_list); if(conf && conf.express_searchtype==1){ @@ -1335,7 +1350,59 @@ App({ return true; } return false; + }, + //---- 判断是不是虚拟商品狗阿米 ----- + is_virtual(gd){ + if(gd.is_virtual==2) return true; + return false; + }, + /** + * + * @param gd 商品 + * @param act 活动 + * @param get_type 0默认 1是加和减的时候 + */ + get_limit_qty(gd,act,get_type){ + var islimit=gd.erp_islimit; //是不是限购 + var limittype=gd.erp_limittype; //不低于0、倍数1 + var limitqty=gd.erp_limitqty; //起购量 + + //-- 如果有活动的时候,就直接返回1 -- + if(act){ + return 1; + //islimit=act.islimit; + //limittype=act.limittype; + //limitqty=act.limitqty; + } + //-- 不是限购的时候,返回1-- + if(!islimit) return 1; + //-- 默认的时候 -- + if(!get_type) return limitqty; + //不低于的时候,加减的时候 + if(!limittype) return 1; + //倍数,加减的时候 + return limitqty; + }, + + //获取商品是不是有促销活动 + async get_has_cx_act(gid){ + var url = '/api/weshop/activitylist/listGoodActInfo2New'; + var req_d = { + "store_id":this.globalData.setting.stoid, + "goods_id": gid, + "user_id":this.globalData.user_id, + } + var res= await this.promiseGet(url,{data:req_d}); + var cx_arr=[]; + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { + var arr = res.data.data; + cx_arr=arr.filter(function (e) { + return e.s_time < ut.gettimestamp() && [3,5,7,10].indexOf(e.prom_type)>-1; + }) + } + return cx_arr; } + }); diff --git a/app.json b/app.json index ef5cf8f..153f35a 100644 --- a/app.json +++ b/app.json @@ -211,6 +211,7 @@ "pages/user/user_fw/user_fw", "pages/user/cardinfo/cardinfo", "pages/user/nick_avatar/nick_avatar", + "pages/user/nick_avatar_add/nick_avatar_add", "pages/user/slimming/slimming", "pages/user/punchInhistory/punchInhistory", "pages/user/grow_value/grow_value", @@ -297,6 +298,9 @@ "usingComponents": { "customtabbar": "custom-tab-bar/index" }, + "requiredPrivateInfos":[ + "getLocation" + ], "useExtendedLib": { "weui": true }, diff --git a/app.wxss b/app.wxss index e161419..1d50246 100644 --- a/app.wxss +++ b/app.wxss @@ -298,7 +298,8 @@ button { font-size: 28rpx; } .xc-wc{ - color: #d60021; + color: #f23030; + /* color: #d60021; */ } .wh100 { diff --git a/components/auto_go/auto_go.js b/components/auto_go/auto_go.js new file mode 100644 index 0000000..c01018d --- /dev/null +++ b/components/auto_go/auto_go.js @@ -0,0 +1,40 @@ +Component({ + /*** 页面的初始数据***/ + data: { + msgStatus:false, + countDownNum:3, //默认3秒后跳转 + stop:0 //强行停止的开关 + }, + methods: { + show:function (){ + this.data.stop=0; + this.setData({msgStatus:true,countDownNum:3}) + this.cut_down(); + }, + hide:function (){ + this.setData({msgStatus:false}) + }, + //-- 定时器跳转 -- + cut_down(){ + if(this.data.stop) return false; + if(this.data.countDownNum>0){ + var a=this.data.countDownNum-1; + this.setData({countDownNum:a}) + setTimeout(()=>{ + this.cut_down(); + },1000); + }else{ + if(this.data.stop) return false; + this.hide(); + this.triggerEvent('childFun'); + } + }, + //-- 3秒跳转的自动关闭 -- + stop(){ + this.data.stop=1; + this.hide(); + } + } + + +}) \ No newline at end of file diff --git a/components/auto_go/auto_go.json b/components/auto_go/auto_go.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/auto_go/auto_go.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/auto_go/auto_go.wxml b/components/auto_go/auto_go.wxml new file mode 100644 index 0000000..b988843 --- /dev/null +++ b/components/auto_go/auto_go.wxml @@ -0,0 +1,6 @@ + + + 暂无进行中活动 + {{countDownNum}} 秒后自动跳到即将开始 + + diff --git a/components/auto_go/auto_go.wxss b/components/auto_go/auto_go.wxss new file mode 100644 index 0000000..ea1e6ef --- /dev/null +++ b/components/auto_go/auto_go.wxss @@ -0,0 +1,21 @@ +@import "../../app.wxss"; + +.no-data .cart-image { + width: 208rpx; + height: 202rpx; +} + +.no-data .no-data-title { + font-size: 28rpx; + color: #b8b8b8; + margin-bottom: 50rpx; +} + +.no-data .lookat { + display: inline-block; + font-size: 28rpx; + border-radius: 10rpx; + background-color: #e83028; + color: white; + padding: 20rpx 50rpx; +} \ No newline at end of file diff --git a/components/com_servicer/com_servicer.wxml b/components/com_servicer/com_servicer.wxml index 81c8f82..56c9844 100644 --- a/components/com_servicer/com_servicer.wxml +++ b/components/com_servicer/com_servicer.wxml @@ -5,7 +5,7 @@ - + 客服热线: {{store_tel}} diff --git a/components/diy_seckill/diy_seckill.js b/components/diy_seckill/diy_seckill.js index 04888f7..271aa21 100644 --- a/components/diy_seckill/diy_seckill.js +++ b/components/diy_seckill/diy_seckill.js @@ -35,7 +35,10 @@ Component({ ylp_img: "https://mshopimg.yolipai.net/", imghost: os.imghost, timer: null, - user_id:0 + user_id:0, + img_width:100, + img_height:100, + swiperHeight:0 }, pageLifetimes: { @@ -44,8 +47,9 @@ Component({ //会员身份变化 var th = this; var g_id = this.data.object; + //只有再会员登陆之后,才重新调用接口 - + console.log('秒杀组件------------'); if(this.data.user_id!=getApp().globalData.user_id){ this.data.user_id=getApp().globalData.user_id this.init(g_id); @@ -67,6 +71,7 @@ Component({ ready: function () { var g_id = this.data.object; + this.init(g_id); this.data.user_id=getApp().globalData.user_id; }, @@ -79,7 +84,7 @@ Component({ customMethod: function () { }, init: function (g_id) { var th = this; - + this.loadImg(g_id) getApp().getConfig2(function (e) { var swithc_list = e.switch_list; var sw_arr = JSON.parse(swithc_list); @@ -109,7 +114,7 @@ Component({ // var gUrl = "/api/ms/flash_sale/getGoodsList?store_id=" + os.stoid + "&goodsidlist=" + goodsidlist+"&user_id="+user_id+"&type=1"; var gUrl = "/api/ms/flash_sale/getGoodsList?store_id=" + os.stoid + "&idlist=" + idlist + "&user_id="+user_id+"&type=1"; app.request.promiseGet(gUrl, {}).then(res => { - + //如果秒杀的数组为空的时候 var goodslist = res.data.data; //就算是添加的活动已经过期,就要用最新的进行中活动 @@ -131,6 +136,7 @@ Component({ getApp().request.promiseGet("/api/ms/flash_sale/spikepage?page=1&pageSize=9", { isShowLoading: 1, data:req } ).then(res => { + if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { var goodsidlist = res.data.data.pageData; this.set_goods_list(null, goodsidlist); @@ -194,23 +200,55 @@ Component({ Promise.all(promisies).then(() => { - // 判断活动是否结束 + let empty=[] for(let i in all_array){ let item=all_array[i]; if(newTime > item.end_time) { all_array[i].status = 3; - }; - + }; + // let price=all_array[i].price.toFixed(2) + let price=all_array[i].price + '' + if (price && price.indexOf('.') > -1) { + let priceArr = price.split(".") + all_array[i].price_n = priceArr[0] + all_array[i].price_xs = priceArr[1] + }else{ + all_array[i].price_n = price + } + + all_array[i].residue=all_array[i].goods_num*1 - all_array[i].buy_num*1 + if (all_array[i].residue && all_array[i].residue > 0 && all_array[i].status !=2) { + empty.push(all_array[i]) + } + } + + //控制已售罄是否显示 + if (!th.data.object.hide_sold_out_items) { + all_array=empty + } + + + var arr = new Array(); + if (th.data.object.style==7) { + //--三个三个一组--- + for (var i = 0; i < all_array.length; i += 2) { + arr.push(all_array.slice(i, i + 2)); + } + }else{ + //--三个三个一组--- + for (var i = 0; i < all_array.length; i += 3) { + arr.push(all_array.slice(i, i + 3)); + } + } + + + /*--熏染到前台--*/ + th.setData({ goods_array: arr }); + if (th.data.object.style==6) { + th.setSwiper_h() } - var arr = new Array(); - //--三个三个一组--- - for (var i = 0; i < all_array.length; i += 3) { - arr.push(all_array.slice(i, i + 3)); - } - /*--熏染到前台--*/ - th.setData({ goods_array: arr }); }); @@ -218,7 +256,30 @@ Component({ th.countDown2(th); }, 1000); }, - + setSwiper_h(){ + var th=this + wx.createSelectorQuery().in(this).select('.swiper_h').boundingClientRect(rect => { + if (rect && rect.height) { + var sumHeigth=(rect.height+13)+'px' + th.setData({ + swiperHeight: sumHeigth + }) + } + }).exec(); + // const query = this.createSelectorQuery() + // query.select('.swiper_h').boundingClientRect() + // query.exec( (res)=> { + // console.log(res) + // console.log(res[0].height) + // console.log(res[0].height * data.t.length) + // let sumHeigth = res[0].height * data.t.length; + // console.error('组件高度'); + // console.log(sumHeigth); + // th.setData({ + // swiperHeight: sumHeigth + // }) + // }) + }, //---小于10的格式化函数---- @@ -285,7 +346,28 @@ Component({ wx.navigateTo({ url: "/pages/activity/seckill_list/seckill_list" }); + }, + //加入购物车 + shoppingCart(){ + console.log('加入购物车'); + }, + loadImg(g_id){ + if (g_id.style==1) { + let w='' + switch (g_id.picture_scale) { + case 1: + w=`width:calc(100%-${g_id.page_margins*2}px);height:calc(100%-${g_id.page_margins*2}px)` + break; + + default: + break; + } + + + + } } + }, diff --git a/components/diy_seckill/diy_seckill.wxml b/components/diy_seckill/diy_seckill.wxml index a2fd889..02ffb73 100644 --- a/components/diy_seckill/diy_seckill.wxml +++ b/components/diy_seckill/diy_seckill.wxml @@ -1,156 +1,582 @@ - - - - - 秒杀 + + + + + + {{object.column_name}} + + + 更多 + - - - - + + + + + + + + + + + + - - - - - - - - - - - - - 即将开始 + + + + + + 已售罄 + + + + + 距结束时间 + 距开始时间 + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + + {{aitem.goods_name}} + + + + 已秒{{aitem.buy_num}} + 还剩余{{aitem.status==2 ? '0' : aitem.residue}} + + + + ¥{{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price}} + + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + 已秒{{aitem.buy_num}} + 还剩余{{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price}} + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + 已秒{{aitem.buy_num}} + {{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} - - - - - - - 火热进行 - - - - - 已抢光 - - - - - 活动已结束 - - - - - - - - - - - - - {{aitem.djs.day}}天 - {{aitem.djs.hou}}时 - {{aitem.djs.min}}分 - {{aitem.djs.sec}}秒 - - - - - - - {{aitem.goods_name}} - ¥{{aitem.price}} - ¥{{aitem.market_price}} + + {{aitem.goods_name}} + + 已秒{{aitem.buy_num}} + {{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price}} + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + + + 距结束时间 + 距开始时间 + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + + {{aitem.goods_name}} + + + + 已秒{{aitem.buy_num}} + 还剩余{{aitem.status==2 ? '0' : aitem.residue}} + + + + ¥{{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price}} + + + + + + {{object.button_content}} + + + - + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + 已秒{{aitem.buy_num}} + 还剩余{{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price}} + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + 已秒{{aitem.buy_num}} + 还剩余{{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price}} + + + + + {{object.button_content}} + + + + + - + + + + + + + + + + + + + + + + + + + + + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + 已秒{{aitem.buy_num}} + 还剩余{{aitem.residue}} + + + + + {{aitem.price}} + ¥{{aitem.shop_price}} + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + 已秒{{aitem.buy_num}} + {{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price}} + + + + + + + + + + + + + + + + + + + + + + 秒杀 + + + + - + + + + + + + + + + + + + 即将开始 + + + + + 火热进行 + + + + + 已抢光 + + + + + 活动已结束 + + - - - - - - - - - - + + + + + - - {{aitem.goods_name}} - - {{aitem.djs.day}} 天 - {{aitem.djs.hou}} : - {{aitem.djs.min}} : - {{aitem.djs.sec}} + + {{aitem.djs.day}}天 + {{aitem.djs.hou}}时 + {{aitem.djs.min}}分 + {{aitem.djs.sec}}秒 + + + + + + + {{aitem.goods_name}} + ¥{{aitem.price}} + ¥{{aitem.market_price}} + - - ¥{{aitem.price}} - + + + + + + + + + + + + + + - - - 正在预热 + + + {{aitem.title}} + + {{aitem.djs.day}} 天 + {{aitem.djs.hou}} : + {{aitem.djs.min}} : + {{aitem.djs.sec}} + - - - - - 已结束 - - - - - - 我要抢 - - - - - - 已抢光 - - - + + ¥{{aitem.price}} + + + + + 正在预热 + + + + + + 已结束 + + + + + + 我要抢 + + + + + + 已抢光 + + + + - - + + - - - - + + + \ No newline at end of file diff --git a/components/diy_seckill/diy_seckill.wxss b/components/diy_seckill/diy_seckill.wxss index c410259..6b1b94b 100644 --- a/components/diy_seckill/diy_seckill.wxss +++ b/components/diy_seckill/diy_seckill.wxss @@ -11,7 +11,8 @@ padding:0rpx 20rpx; display: flex; justify-content: space-between; - font-size: 32rpx; + /* font-size: 32rpx; */ + font-size: 24rpx; } .s_it { @@ -32,19 +33,22 @@ swiper { } .right_k { - width: 30rpx; + width: 93rpx; + color: #7b7b7b; } .right_k image{ - width: 30rpx; - height: 30rpx; + width: 20rpx; + height: 20rpx; } .t_left { width: 10rpx; height: 38rpx; - background: #c4182e; + background: #f23030; margin-right: 10rpx; } - +.n_t_ms{ + color:#f23030; +} .sp { min-height: 300rpx; @@ -292,9 +296,218 @@ swiper { .ellipsis-2 { + + height: 110rpx; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; -} \ No newline at end of file +} +.ellipsis-2n { + + /* height: 97rpx; */ + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} +.pdlf10{ + padding: 0 10rpx; +} +.new_item1{ + width: 100%; + overflow: hidden; +} + +.new_item1_image{ + width: 100%; + /* max-width: 100%; + max-height: 100%; */ +} +.new_item1_time{ + height: 60rpx; + background: #f23030; + color: #fff; + /* font-size: 25rpx; */ + font-size: 24rpx; + display: flex; + justify-content: space-between; + align-items: center; + /* padding: 0rpx 30rpx; */ + +} +.new_item1_time image{ + width: 188rpx; + height: 52rpx; +} +.new_item1_goods_name{ + padding: 10rpx 10rpx 0rpx; + /* font-size: 26rpx; */ + font-size: 28rpx; + width: 100%; + box-sizing: border-box; + color: #333333; +} +.new_item1_price{ + display: flex; + /* padding: 0 10rpx; */ + align-items: center; + justify-content: space-between; + /* font-size: 26rpx; */ + font-size: 24rpx; + padding: 0 10rpx 10rpx; +} +.clor{ + /* color: rgba(196, 24, 45, 1); */ + color: #ec0022; +} +.clor7b{ + color: #7b7b7b; +} +.new_item1_but{ + width: 130rpx; + height: 60rpx; + color: #fff; + background-color: #f23030; + line-height: 60rpx; + text-align: center; + border-radius: 15rpx; +} +.new_item1_but1{ + border-radius: 50rpx !important; +} +.new_item1_but2{ + border-radius: 50rpx !important; + background-color: rgba(0, 0, 0, 0) !important; + color: #f23030 !important; + border: 1rpx solid #f23030 !important; +} +.new_item1_but3{ + background-color: rgba(0, 0, 0, 0) !important; + color: #f23030 !important; + border: 1rpx solid #f23030 !important; +} + + + + +.new_item1_box{ + /* padding-top: 17rpx; */ + width: 100%; + box-sizing: border-box; + overflow: hidden; +} + +.aborder{ + border: 1px solid #e8e8e8; +} +.bgf{ + background-color: #fff; +} +.boxsha{ + /* box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.25); */ + /* box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); */ + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 3px 10px 0 rgba(0, 0, 0, 0.19); +} +.but_radius85{ + border-radius:289rpx; +} +.but_radius5{ + border-radius:8px; +} +.imgBox{ + position: relative; +} +.imgBox_img{ + position: absolute; + left: 0; + top: 0; + width: 74rpx; + height: 70rpx; + +} + +.aspect_ratio1{ + aspect-ratio:1/1; +} +.aspect_ratio2{ + aspect-ratio:16/9; +} +.aspect_ratio3{ + aspect-ratio:3/2; +} +.aspect_ratio4{ + aspect-ratio:3/4; +} +.container1 { + position: relative; + width:100%; + padding-top: 100%; + overflow: hidden; +} +.container2 { + position: relative; + width:100%; + padding-top: 56.25%; + overflow: hidden; +} +.container3 { + position: relative; + width:100%; + padding-top: 66.67%; + overflow: hidden; +} +.container4 { + position: relative; + width:100%; + padding-top: 133.33%; + overflow: hidden; + +} + +.images1 { + display: block; + position: absolute; + width: 100%; + height: 100%; + top: 0; + bottom: 0; + left: 0; + right: 0; + object-fit: cover; + +} + +.flex2{ + display: flex; + /* align-items: center; */ + justify-content: space-between; + flex-wrap: wrap; + box-sizing: border-box; +} +.flex2:after { + content: ""; + width: 30%; + height: 0px; + visibility: hidden; + } + + .boxpad{ + /* padding:11rpx 9rpx; */ + box-sizing: border-box; + } + .pricefs28{ + font-size: 28rpx !important; + } + .pricefs42{ + font-size: 42rpx !important; + } + .pricefs38{ + font-size: 38rpx !important; + } + .imgbox1{ + width: 60rpx; + height: 60rpx; + } \ No newline at end of file diff --git a/components/diy_video/diy_video.wxml b/components/diy_video/diy_video.wxml index fc763f0..24b0d05 100644 --- a/components/diy_video/diy_video.wxml +++ b/components/diy_video/diy_video.wxml @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/packageA/pages/cart2_ser/cart2_ser.js b/packageA/pages/cart2_ser/cart2_ser.js index e8cce1e..6cd7c92 100644 --- a/packageA/pages/cart2_ser/cart2_ser.js +++ b/packageA/pages/cart2_ser/cart2_ser.js @@ -634,7 +634,7 @@ Page({ }); setTimeout(function () { wx.reLaunch({ - url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + order_id, + url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + th.data.order_id, }) }, 1000) @@ -653,6 +653,7 @@ Page({ } ) + // getApp().request.post("/api/weshop/order/pay/createRechargeOrder", { // data: { diff --git a/packageA/pages/goodsInfo/buy_flash_normal.wxml b/packageA/pages/goodsInfo/buy_flash_normal.wxml index 72e8a72..42280d9 100644 --- a/packageA/pages/goodsInfo/buy_flash_normal.wxml +++ b/packageA/pages/goodsInfo/buy_flash_normal.wxml @@ -51,7 +51,7 @@ (库存不足) (配送不匹配) - (库存不足) + (库存不足) 地址:{{def_pick_store.fulladdress}} diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 3c956b7..9746d05 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -510,16 +510,7 @@ Page({ }); }; // <---- 秒杀 - - - - - - - - - //------是否收藏---------- await getApp().request.promiseGet("/api/weshop/goodscollect/page", { data: { @@ -1027,21 +1018,15 @@ Page({ }); is_ok=0; return false; - }; - }; - - - }); - - - - }; - }); + } + } + }) + + } + }) - }; - - - }; + } + } if(!is_ok) return false; @@ -3894,507 +3879,7 @@ Page({ }); }, - - - - - - - //-- 加入购物的函数 -- - add_cart_func: function (t) { - var i = getApp().request; - if (oo.user_id == null) { - return s.my_warnning("还未登录!", 0, this); - } - - if (!getApp().globalData.userInfo) { - return s.my_warnning("还未登录!", 0, this); - } - - var e = this, - th = e, - a = 0, - o = this.data.sele_g; - a = o.goods_id; - - //----------添加到购物车时,要判断限购数量,-------- - e.get_buy_num(o, function (ee) { - //---判断商品是否超出限购--- - if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { - if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { - // wx.showModal({ - // title: '提示', - // content: '超出活动限购数量' - // }); - getApp().my_warnning('超出活动限购数量', 0, self); - return false; - } - } - //---判断商品是否超出活动限购--- - if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) { - if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { - // wx.showModal({ - // title: '提示', - // content: '超出活动限购数量' - // }); - getApp().my_warnning('超出活动限购数量', 0, self); - return false; - } - } - - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); - if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) - th.setData({ - sto_sele_name: "" - }); - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); - - //--------------此时操作的数据------------ - var newd = { - goods_id: o.goods_id, - goods_num: th.data.goodsInputNum, - pick_id: th.data.sto_sele_id, - user_id: oo.user_id, - store_id: th.data.stoid, - goods_price: o.shop_price, - member_goods_price: o.shop_price, - goods_name: o.goods_name, - goods_sn: o.goods_sn, - sku: o.sku, - prom_id: th.data.sele_g.prom_id, - prom_type: th.data.sele_g.prom_type, - }; - - //---是不是从收藏夹出来的--- - if (th.data.c_guide_id) { - newd['guide_id'] = th.data.c_guide_id; - newd['guide_type'] = 2; - if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3; - } else { - if (getApp().globalData.guide_id) { - newd['guide_id'] = getApp().globalData.guide_id; - newd['guide_type'] = 0; - if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1; - } - } - if(getApp().globalData.groupchat_id){ - newd['groupchat_id'] = getApp().globalData.groupchat_id; - } - //让商品带上房间号 - //让商品带上房间号 - if (th.data.sys_switch.is_skuroom_id == 1) { - if (th.data.data.goods_id == getApp().globalData.room_goods_id) { - newd.room_id = getApp().globalData.room_id; - } - } else { - if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id; - } - - //如果是积分够,is_integral_normal就要有积分购普通购买字段 - if (o.prom_type == 4) { - newd.is_integral_normal = 1; - } - - //如果有线下取价 - if (o.offline_price) { - newd.offline_price = o.offline_price; - newd.pricing_type = o.pricing_type; - } - - //-----如果是秒杀,团购,积分购,拼团----- - if (th.data.prom_type == 1 || th.data.prom_type == 2) { - - if (th.data.openSpecModal_flash_normal) { - - newd.prom_type = 0; - newd.prom_id = 0; - - //---如果是线下门店销售的时候--- - if (th.data.sales_rules == 2) { - var pick = th.get_pick_from_list(th.data.sto_sele_id) - //---通过接口获取门店的线下库存信息-- - getApp().request.get("/api/weshop/goods/getWareStorages", { - data: { - storageNos: pick.pickup_no, - wareIds: encodeURIComponent(th.data.sele_g.erpwareid), - storeId: os.stoid - }, - success: function (res) { - if (res.data.code == 0) { - if (res.data.data.pageData.length > 0) { - var CanOutQty = res.data.data.pageData[0].CanOutQty; - if (CanOutQty < e.data.goodsInputNum) { - return s.my_warnning("库存不足!", 0, th); - } - //在调一次接口,读取商品的预出库的数量,lock - getApp().request.get("/api/weshop/order/ware/lock/page", { - data: { - store_id: os.stoid, - wareId: th.data.sele_g.goods_id, - storageId: pick.pickup_id, - pageSize: 1000 - }, - success: function (res_data) { - if (res_data.data.code == 0 && res_data.data.data.total > 0) { - - var lock = 0; - for (var i in res_data.data.data.pageData) { - lock += res_data.data.data.pageData[i].outQty; - } - - if (CanOutQty <= lock) { - return s.my_warnning("库存不足!", 0, th); - } - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); - } else { - th.add_cart_next(e, t, a, o, newd, CanOutQty); - } - } - }) - } else { - return s.my_warnning("库存不足!", 0, th); - } - - } - } - }) - } else { - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 - } - - return false; - } - - - newd.goods_price = th.data.prom_price; - newd.member_goods_price = th.data.prom_price, - newd.prom_type = th.data.prom_type; - newd.prom_id = th.data.prom_id; - - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); - - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 - - } else if (o.prom_type == 7) { - - //判断进行中的活动,是不是要判断线下库存 - th.check_zh_acting(function (ee) { - newd.prom_id = 0; - newd.prom_type = 0; - if (ee && th.data.sele_g.act) { - newd.prom_id = th.data.sele_g.act.id; - newd.prom_type = 7; - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 - return false; - } else { - //---如果是线下门店销售的时候--- - if (th.data.sales_rules == 2) { - var pick = th.get_pick_from_list(th.data.sto_sele_id) - //---通过接口获取门店的线下库存信息-- - getApp().request.get("/api/weshop/goods/getWareStorages", { - data: { - storageNos: pick.pickup_no, - wareIds: encodeURIComponent(th.data.sele_g.erpwareid), - storeId: os.stoid - }, - success: function (res) { - if (res.data.code == 0) { - if (res.data.data.pageData.length > 0) { - var CanOutQty = res.data.data.pageData[0].CanOutQty; - if (CanOutQty < e.data.goodsInputNum) { - return s.my_warnning("库存不足!", 0, th); - } - //在调一次接口,读取商品的预出库的数量,lock - getApp().request.get("/api/weshop/order/ware/lock/page", { - data: { - store_id: os.stoid, - wareId: th.data.sele_g.goods_id, - storageId: pick.pickup_id, - pageSize: 1000 - }, - success: function (res_data) { - if (res_data.data.code == 0 && res_data.data.data.total > 0) { - - var lock = 0; - for (var i in res_data.data.data.pageData) { - lock += res_data.data.data.pageData[i].outQty; - } - - if (CanOutQty <= lock) { - return s.my_warnning("库存不足!", 0, th); - } - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); - } else { - th.add_cart_next(e, t, a, o, newd, CanOutQty); - } - } - }) - } else { - return s.my_warnning("库存不足!", 0, th); - } - - } - } - }) - } else { - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 - } - } - }) - - } - else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 4 || th.data.prom_type == 5 || th.data.prom_type == 10) { - newd.prom_type = 0; - newd.prom_id = 0; - - if (th.data.prom_type == 10) { - newd.prom_type = th.data.prom_type; - newd.prom_id = th.data.prom_id; - } - - //---如果是线下门店销售的时候--- - if (th.data.sales_rules == 2) { - var pick = th.get_pick_from_list(th.data.sto_sele_id) - //---通过接口获取门店的线下库存信息-- - getApp().request.get("/api/weshop/goods/getWareStorages", { - data: { - storageNos: pick.pickup_no, - wareIds: encodeURIComponent(th.data.sele_g.erpwareid), - storeId: os.stoid - }, - success: function (res) { - if (res.data.code == 0) { - if (res.data.data.pageData.length > 0) { - var CanOutQty = res.data.data.pageData[0].CanOutQty; - if (CanOutQty < e.data.goodsInputNum) { - return s.my_warnning("库存不足!", 0, th); - } - //在调一次接口,读取商品的预出库的数量,lock - getApp().request.get("/api/weshop/order/ware/lock/page", { - data: { - store_id: os.stoid, - wareId: th.data.sele_g.goods_id, - storageId: pick.pickup_id, - pageSize: 1000 - }, - success: function (res_data) { - if (res_data.data.code == 0 && res_data.data.data.total > 0) { - - var lock = 0; - for (var i in res_data.data.data.pageData) { - lock += res_data.data.data.pageData[i].outQty; - } - - if (CanOutQty <= lock) { - return s.my_warnning("库存不足!", 0, th); - } - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); - } else { - th.add_cart_next(e, t, a, o, newd, CanOutQty); - } - } - }) - } else { - return s.my_warnning("库存不足!", 0, th); - } - - } - } - }) - } else { - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 - } - } - }) - }, - - //---加入购物车的最后一步--- - add_cart_next(e, t, a, o, newd, CanOutQty) { - var th = this, i = getApp().request; - //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ - if ((o.prom_type != 1 || o.prom_id <= 0) && ((o.prom_type != 6 && o.prom_type != 4 && o.prom_type != 2 ) || th.data.is_normal)) { - var conf = th.data.bconfig; - if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) { - var s_list = JSON.parse(conf.switch_list); - var now = ut.gettimestamp(); - - - var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; - - //--如果后台有开启等级价的功能,而且会员的等级没有过期的情况下-- - if (parseInt(s_list.rank_switch) == 2 && end > now) { - var card_price = o[getApp().globalData.userInfo['card_field']]; - //如果会员有等级价 - if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null - && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) { - newd.goods_price = card_price; - newd.member_goods_price = card_price; - } - } - } - } - - //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d); - if ("add" == t.currentTarget.dataset.action) { - - if (th.data.prom_goods) { - newd.prom_type = 3; - newd.prom_id = th.data.prom_goods[0].prom_id; - } - - //----先看会员在购物车中是否加入了该商品----- - i.get("/api/weshop/cart/page", { - data: { - store_id: e.data.stoid, - user_id: oo.user_id, - goods_id: a, - pick_id: e.data.sto_sele_id, - prom_type:(newd.prom_type?newd.prom_type:0), - state: 0 - }, - success: function (re) { - - //-------如果购物车中有相关的数据--------- - if (re.data.data.total > 0) { - - var item = re.data.data.pageData[0]; - - //判断数量,要看下购物车中有没有该商品 - if (CanOutQty) { - if (item.goods_num + th.data.goodsInputNum > CanOutQty) { - return s.my_warnning("库存不足!", 0, th); - } - } else { - if (item.goods_num + th.data.goodsInputNum > o.store_count) { - return s.my_warnning("库存不足!", 0, th); - } - } - - var updata = { - id: item.id, - goods_num: e.data.goodsInputNum + item.goods_num, - goods_price: newd.goods_price, - member_goods_price: newd.goods_price, - store_id: th.data.stoid, - }; - - //---是不是从收藏夹出来的--- - if (th.data.c_guide_id) { - updata['guide_id'] = th.data.c_guide_id; - updata['guide_type'] = 3; //加入购物车之后就变成了3 - } else { - if (getApp().globalData.guide_id) { - updata['guide_id'] = getApp().globalData.guide_id; - updata['guide_type'] = 0; - } - } - if(getApp().globalData.groupchat_id){ - updata['groupchat_id'] = getApp().globalData.groupchat_id; - } - i.put("/api/weshop/cart/update", { - data: updata, - success: function (t) { - getApp().my_warnning('加入购物车成功', 1, th, 450); - var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; - th.setData({ - cartGoodsNum: c_num - }); - th.closeSpecModal(); - } - }); - } else { - - - i.post("/api/weshop/cart/save", { - data: newd, - success: function (t) { - getApp().my_warnning('加入购物车成功', 1, th, 450); - var c_num = th.data.cartGoodsNum + e.data.goodsInputNum; - th.setData({ - cartGoodsNum: c_num - }); - th.closeSpecModal(); - } - }); - } - } - }); - - } - else { - - //这一步主要是要让立即购买 走 购物车的逻辑 参与活动 - if (newd.prom_type == 10 || newd.prom_type == 7) { - //----先看会员在购物车中是否加入了该商品,立即购买的----- - getApp().request.get("/api/weshop/cart/page", { - data: { - store_id: e.data.stoid, - user_id: oo.user_id, - state: 1 - }, - success: function (res) { - //-------如果购物车中有相关的数据--------- - if (res.data.code == 0 && res.data.data.total > 0) { - for (let j in res.data.data.pageData) { - let item_j = res.data.data.pageData[j]; - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id; - getApp().request.delete(url, {}); - } - } - newd.state = 1; - getApp().request.post("/api/weshop/cart/save", { - data: newd, - success: function (t) { - th.closeSpecModal(); - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1"); - } - }); - }, - }) - return false; - } - - if (th.data.prom_goods) { - var prom_d = th.data.prom_goods; - for (var i in prom_d) { - //判断活动有俩种条件,0元 1件 - var condition_t = prom_d[i].prom_type; - switch (condition_t) { - case 0: //按钱 - if (newd.goods_price >= condition_t) { - newd.prom_type = 3; - newd.prom_id = prom_d[i].prom_id; - } - break - case 1://按购买数量 - if (newd.goods_num >= condition_t) { - newd.prom_type = 3; - newd.prom_id = prom_d[i].prom_id; - } - break; - } - } - - } - - newd['pick_name'] = th.data.sto_sele_name; - newd['pick_dis'] = th.data.sto_sele_distr; - th.buyNow(newd); - } - }, - - + click_contact:function () { getApp().globalData.no_clear=1; }, diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml index abf7f1b..101a376 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/goodsInfo/goodsInfo.wxml @@ -638,6 +638,7 @@ + - + @@ -50,7 +51,7 @@ 姓名: - + +{{reg_info.name}}积分 +{{reg_info.name}}成长值 @@ -90,14 +91,16 @@ 出生日期: - + + + + + + - - {{datet?datet:"请选择时间"}} - diff --git a/packageA/pages/prom_list/prom_list.js b/packageA/pages/prom_list/prom_list.js index 254846a..fdb4160 100644 --- a/packageA/pages/prom_list/prom_list.js +++ b/packageA/pages/prom_list/prom_list.js @@ -351,7 +351,7 @@ Page({ //获取统一条形码,普通商品和优惠促销的商品 //默认门店要拿下门店库存 - if (that.data.sales_rules >= 2) { + if (!getApp().is_virtual(t.data.data) && !t.data.data.whsle_id && that.data.sales_rules >= 2) { //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 getApp().waitfor2(that, "wait_for_user_store", "fir_def_store", function () { @@ -1622,12 +1622,12 @@ Page({ var plist=null; var lock=0; - //---如果是活动的时候--- - if(th.data.prom_type==1 || th.data.prom_type==6){ + //---如果是活动的时候,或者是虚拟商品的时候--- + if(th.data.prom_type==1 || th.data.prom_type==6 || getApp().is_virtual(goodsinfo)){ func(); return false; } - if(this.data.sales_rules!=2){ + if(this.data.sales_rules<2){ func(); }else{ diff --git a/packageA/pages/prom_list/prom_list.wxml b/packageA/pages/prom_list/prom_list.wxml index d5dad88..5b7cb2b 100644 --- a/packageA/pages/prom_list/prom_list.wxml +++ b/packageA/pages/prom_list/prom_list.wxml @@ -113,7 +113,7 @@ (库存不足) (配送不匹配) - (库存不足) + (库存不足) @@ -160,9 +160,8 @@ 请先选择门店 - + - 库存不足 diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml index 063418c..eb4ee7e 100644 --- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml @@ -926,7 +926,7 @@ - + 客服热线: {{store_tel}} diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml index 15fa211..00a4994 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml @@ -25,12 +25,14 @@ 已售:{{sele_g.sales_sum}} - - 可售:{{def_pick_store.CanOutQty}} - 可售:0 - - 可售:{{sele_g.store_count}} - + + + 可售:{{def_pick_store.CanOutQty}} + 可售:0 + + + 可售:{{sele_g.store_count}} + @@ -119,7 +121,7 @@ - - + + + diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 7f65661..7c91549 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -575,7 +575,9 @@ Page({ var that = this, th = this; getApp().getConfig2(function (e) { var sales_rules = e.sales_rules; - if (sales_rules >= 2) { + + //虚拟商品, 代发商品不计算 + if (!that.data.fir_goods.whsle_id && sales_rules >= 2) { getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { var lock = 0, plist = null; var gd = that.data.fir_goods; @@ -1044,7 +1046,7 @@ Page({ //-- 把商品的赋值 -- ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); - if (ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6) + if (ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 9) ee.check_is_youhui(ee.data.gid); t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); @@ -1570,7 +1572,7 @@ Page({ // title: '提示', // content: '超出商品限购' // }); - getApp().my_warnning('超出商品限购', 0, th); + getApp().my_warnning('超出商品限购', 0, th); return false; } } @@ -1581,7 +1583,7 @@ Page({ // title: '提示', // content: '超出商品活动限购' // }); - getApp().my_warnning('超出商品活动限购', 0, th); + getApp().my_warnning('超出商品活动限购', 0, th); return false; } } @@ -1672,7 +1674,7 @@ Page({ return false; } else { //---如果是线下门店销售的时候--- - if (th.data.sales_rules >= 2) { + if(!th.data.sele_g.whsle_id && th.data.sales_rules >= 2) { var pick = th.get_pick_from_list(th.data.sto_sele_id) //---通过接口获取门店的线下库存信息-- // getApp().request.get("/api/weshop/goods/getWareStorages", { @@ -1748,45 +1750,9 @@ Page({ newd.prom_id = 0; //---如果是线下门店销售的时候--- - if (th.data.sales_rules >= 2) { + if(!th.data.sele_g.whsle_id && th.data.sales_rules >= 2) { var pick = th.get_pick_from_list(th.data.sto_sele_id) - //---通过接口获取门店的线下库存信息-- - // getApp().request.get("/api/weshop/goods/getWareStorages", { - // data: { storageNos: pick.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid }, - // success: function (res) { - // if (res.data.code == 0) { - // if (res.data.data.pageData.length > 0) { - // var CanOutQty = res.data.data.pageData[0].CanOutQty; - // if (CanOutQty < e.data.goodsInputNum) { - // return s.my_warnning("库存不足!", 0, th); - // } - // //在调一次接口,读取商品的预出库的数量,lock - // getApp().request.get("/api/weshop/order/ware/lock/page", { - // data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, storageId: pick.pickup_id, pageSize: 1000 }, - // success: function (res_data) { - // if (res_data.data.code == 0 && res_data.data.data.total > 0) { - // - // var lock = 0; - // for (var i in res_data.data.data.pageData) { - // lock += res_data.data.data.pageData[i].outQty; - // } - // - // if (CanOutQty <= lock) { - // return s.my_warnning("库存不足!", 0, th); - // } - // th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); - // } else { - // th.add_cart_next(e, t, a, o, newd, CanOutQty); - // } - // } - // }) - // } else { - // return s.my_warnning("库存不足!", 0, th); - // } - // - // } - // } - // }) + th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { @@ -2188,11 +2154,19 @@ Page({ //----------增加购买数量----------- addCartNum: function (t) { - this.checkCartNum(this.data.goodsInputNum + 1); + var add_num=1; + if(this.data.is_normal == 1){ + add_num=getApp().get_limit_qty(this.data.sele_g,this.data.is_act,1); + } + this.checkCartNum(this.data.goodsInputNum + add_num); }, //----------减少购买数量----------- subCartNum: function (t) { - this.checkCartNum(this.data.goodsInputNum - 1); + var add_num=1; + if(this.data.is_normal == 1){ + add_num=getApp().get_limit_qty(this.data.sele_g,this.data.is_act,1); + } + this.checkCartNum(this.data.goodsInputNum - add_num); }, //----------输入框输入购买数量----------- inputCartNum: function (t) { @@ -2216,8 +2190,14 @@ Page({ //------检查数量是不是超出限购------ checkCartNum: function (t) { var th = this; + var mo_num=getApp().get_limit_qty(th.data.sele_g,th.data.is_act); + var steep=getApp().get_limit_qty(th.data.sele_g,th.data.is_act,1); + this.get_buy_num(this.data.sele_g, async function () { + + var is_show_bs=0; + var l_num=-1; //--判断商品是否超出限购-- if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { @@ -2228,10 +2208,11 @@ Page({ // title: '超出商品限购', // }); getApp().my_warnning('超出商品限购', 0, th); - var num = th.data.sele_g.viplimited - gd_buy_num; - if (num < 0) num = 0; - th.setData({ goodsInputNum: num }) - return false; + l_num = th.data.sele_g.viplimited - gd_buy_num; + if (l_num < 0) l_num = 0; + //th.setData({ goodsInputNum: num }) + //return false; + is_show_bs=1; } } @@ -2269,23 +2250,76 @@ Page({ } } var e = th.data.sele_g.store_count; - var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 - if (th.data.sales_rules >= 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { - if (!th.data.def_pick_store) { - wx.showModal({ title: '请选择门店', }); - return false; - } else { - e = th.data.def_pick_store.CanOutQty; + var p_type = parseInt(th.data.prom_type); //&& p_type!=1 && p_type!=4 + if (!th.data.sele_g.whsle_id && + th.data.sales_rules >= 2 && ( [1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { + + //-- 如果是虚拟商品,默认给最大值 -- + if(getApp().is_virtual(th.data.sele_g)){ + e =100000; + }else{ + if (!th.data.def_pick_store) { + wx.showModal({ title: '请选择门店', }); + return false; + } else { + e = th.data.def_pick_store.CanOutQty; + } } } + + //-- 限购数量也要进行计算一下 -- + if(l_num>-1){ + if(e>l_num) e=l_num; + } + + //提示了一个,就不要提示第二个 + var is_show_bs=0; + //--- 促销活动也不控制起订量, 这里很重要的一个控制,起订量的 ---- + if(th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1){ + if(tmo_num && (t-mo_num)%steep!=0){ + if(!is_show_bs) { + wx.showToast({ + title: '购买数必须是起订量的倍数', + icon: 'none', + }); + } + t=mo_num+ parseInt((t-mo_num)/steep)*steep+steep; + is_show_bs=1; + } + } + if (!e) e = 0; //库存不足,不增加 if (e < t) { - wx.showModal({ title: '库存不足', }); + if(!is_show_bs) wx.showModal({ title: '库存不足', }); if (e < 0) e = 0; + + if(th.data.is_normal == 1){ + if(emo_num && (e-mo_num)%steep!=0){ + e=mo_num+ parseInt((e-mo_num)/steep)*steep; + } + } + th.setData({ goodsInputNum: e }); return false; } + t > e || 0 == e ? t = e : t < 1 && (t = 1); + //只有普通商品才有起购数 + if(th.data.is_normal == 1){ + if(t= 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { - if (!th.data.def_pick_store) { - wx.showModal({ title: '请选择门店', }); - return false; - } else { - e = th.data.def_pick_store.CanOutQty; + var p_type = parseInt(th.data.prom_type); //&& p_type!=1 && p_type!=4 + if (!th.data.sele_g.whsle_id && + th.data.sales_rules >= 2 && ([1,2,4,6,8,9].indexOf(p_type)== -1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { + + //-- 如果是虚拟商品,默认给最大值 -- + if(getApp().is_virtual(th.data.sele_g)){ + e=100000; + }else{ + if (!th.data.def_pick_store) { + wx.showModal({ title: '请选择门店', }); + return false; + } else { + e = th.data.def_pick_store.CanOutQty; + } } + } if (!e) e = 0; //库存不足,不增加 @@ -2983,7 +3025,7 @@ Page({ //默认门店要拿下门店库存 - if (that.data.sales_rules >= 2 && that.data.def_pick_store) { + if (!getApp().is_virtual(item) && !item.whsle_id && that.data.sales_rules >= 2 && that.data.def_pick_store) { var lock = 0, plist = null; // //先读取门店的lock,采用链式写法,少用await // getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { @@ -3181,11 +3223,18 @@ Page({ for (let i in e.data.data.pageData) { let item = e.data.data.pageData[i]; if (item.category_id > 0) { - his_cate_num = 1; break; + his_cate_num = 1; + } + if(getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2){ + e.data.data.pageData[i].CanOutQty=100000; } } e.his_cate_num = his_cate_num; - + if(th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}' + && getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2) + { + th.setData({'def_pick_store.CanOutQty':100000}) + } //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) { @@ -3213,7 +3262,8 @@ Page({ th.setData({ all_pick_list: e.data.data.pageData }); //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- - if (th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 9 && th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { + if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && + th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ([1,2,4,6,8,9].indexOf(th.data.prom_type)== -1 || is_normal == 1)) { setTimeout(function () { th.deal_pickup_dline(e); }, 800) @@ -3351,6 +3401,7 @@ Page({ all_sto: newarr }); + } else { th.setData({ is_show_sto_cat: -1, @@ -3414,8 +3465,6 @@ Page({ var g_distr_type = th.data.sele_g.distr_type; var lock = []; - - var lock_rq = { store_id: os.stoid, wareId: th.data.sele_g.goods_id, @@ -4298,7 +4347,7 @@ Page({ // ind == 1 为普通购买 openSpecModel_pt: function (e) { - this.setData({ open_ind_store: 9, goodsInputNum: 1 }); + this.setData({ open_ind_store: 9 }); // 判断是否有待支付订单 var aid = this.data.group_id; var switOn = true; @@ -4426,7 +4475,8 @@ Page({ th.get_sto(); th.setData({ is_normal: 0, - openSpecModal_pt: 1 + openSpecModal_pt: 1, + goodsInputNum:1 }); } @@ -4442,9 +4492,7 @@ Page({ //-----------------拼单生成方法--------------------- addCart_pt: function () { - this.setData({ - openSpecModal_pt: 0, - }); + if (this.data.is_normal == 0) { //看一下有没有起购数,如果有起购数,要计算起购数 // var qnum = parseFloat(th.data.prom_act.minbuynum); @@ -4472,172 +4520,256 @@ Page({ //----------添加到购物车时,要判断限购数量,-------- e.get_buy_num(o, async function (ee) { - //---判断商品是否超出限购--- - // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { - // if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { - // wx.showModal({ - // title: '提示', - // content: '超出商品限购' - // }); - - // var num = th.data.prom_buy_limit - th.data.prom_buy_num; - // if (num < 0) num = 0; - // th.setData({ goodsInputNum: num }) - // return false; - // } - // } + //---判断商品是否超出限购--- + if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { + wx.showModal({ + title: '提示', + content: '超出商品限购' + }); - //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购--- - // if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { - // if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { - // wx.showModal({ - // title: '提示', - // content: '超出商品活动限购' - // }); - - // var num = th.data.prom_buy_limit - th.data.prom_buy_num; - // if (num < 0) num = 0; - // th.setData({ goodsInputNum: num }) - // return false; - // } - // } + var num = th.data.prom_buy_limit - th.data.prom_buy_num; + if (num < 0) num = 0; + th.setData({goodsInputNum: num}) + return false; + } + } - var redis_num = 0 - //不是普通购买的时候 - // if (th.data.is_normal != 1) { - // //-------判断活动是否抢光--------- - // await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, { - // 1: 1 - // }).then(res => { - // redis_num = res.data.data; - // }) - // if (th.data.goodsInputNum > redis_num) { - // wx.showModal({ - // title: '提示', - // content: '超出商品活动库存' - // }); + var redis_num = 0 - // th.setData({ goodsInputNum: redis_num }) + if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) + th.setData({ + sto_sele_name: "" + }); - // return false; - // } - // } + if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); + + //--------------此时操作的数据------------ + var newd = { + goods_id: o.goods_id, + goods_num: th.data.goodsInputNum, + pick_id: th.data.sto_sele_id, + user_id: oo.user_id, + store_id: th.data.stoid, + goods_price: o.shop_price, + goods_name: o.goods_name, + goods_sn: o.goods_sn, + sku: o.sku, + }; - // if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); - // if (th.data.goodsInputNum > o.store_count) { - // th.setData({ goodsInputNum: o.store_count }) - // return s.my_warnning("超出商品库存", 0, th); - // } + //---是不是从收藏夹出来的--- + if (th.data.c_guide_id) { + newd['guide_id'] = th.data.c_guide_id; + newd['guide_type'] = 2; - if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) - th.setData({ - sto_sele_name: "" - }); - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); + } else { + if (getApp().globalData.guide_id) { + newd['guide_id'] = getApp().globalData.guide_id; + newd['guide_type'] = 0; - //--------------此时操作的数据------------ - var newd = { - goods_id: o.goods_id, - goods_num: th.data.goodsInputNum, - pick_id: th.data.sto_sele_id, - user_id: oo.user_id, - store_id: th.data.stoid, - goods_price: o.shop_price, - goods_name: o.goods_name, - goods_sn: o.goods_sn, - sku: o.sku, - }; + } + } + if (getApp().globalData.groupchat_id) { + newd['groupchat_id'] = getApp().globalData.groupchat_id; + } + //让商品带上房间号 + if (th.data.sys_switch.is_skuroom_id == 1) { + if (th.data.data.goods_id == getApp().globalData.room_goods_id) { + newd.room_id = getApp().globalData.room_id; + } + } else { + if (newd.goods_id == getApp().globalData.room_goods_id) { + newd.room_id = getApp().globalData.room_id; + } + } - //---是不是从收藏夹出来的--- - if (th.data.c_guide_id) { - newd['guide_id'] = th.data.c_guide_id; - newd['guide_type'] = 2; + //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ - } else { - if (getApp().globalData.guide_id) { - newd['guide_id'] = getApp().globalData.guide_id; - newd['guide_type'] = 0; + if (th.data.is_normal == 1) { + var conf = th.data.bconfig; + if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) { + var s_list = JSON.parse(conf.switch_list); - } - } - if(getApp().globalData.groupchat_id){ - newd['groupchat_id'] = getApp().globalData.groupchat_id; - } - //让商品带上房间号 - if (th.data.sys_switch.is_skuroom_id == 1) { - if (th.data.data.goods_id == getApp().globalData.room_goods_id) { - newd.room_id = getApp().globalData.room_id; - } - } else { - if (newd.goods_id == getApp().globalData.room_goods_id) { - newd.room_id = getApp().globalData.room_id; - } - } + var now = ut.gettimestamp(); + + var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + + //如果后台有开启等级价的功能 + if (parseInt(s_list.rank_switch) == 2 && end > now) { + var card_price = o[getApp().globalData.userInfo['card_field']]; + //如果会员有等级价 + if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null + && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) { + newd.goods_price = card_price; + } + } + } + + //---如果是线下门店销售的时候--- + if (th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) { + var pick = th.get_pick_from_list(th.data.sto_sele_id) + + th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { + if (CanOutQty) { + + if (CanOutQty < e.data.goodsInputNum) { + wx.showToast({ + title: '库存不足!', + icon: 'none', + }); + return false; + } + + th.by_next_func(newd); + } else { + wx.showToast({ + title: '库存不足!', + icon: 'none', + }); + return false; + } + }) + + } else { + if (o.store_count <= 0) { + wx.showToast({ + title: '库存已为空!', + icon: 'none', + }); + return false; + //return s.my_warnning("库存已为空!", 0, th); + } + + if (o.store_count < e.data.goodsInputNum) { + wx.showToast({ + title: '库存不足!', + icon: 'none', + }); + return false; + //return s.my_warnning("库存不足!", 0, th); + } - //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ - if (th.data.is_normal == 1) { - var conf = th.data.bconfig; - if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) { - var s_list = JSON.parse(conf.switch_list); + th.by_next_func(newd); + } + return false; - var now = ut.gettimestamp(); - var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; + } - //如果后台有开启等级价的功能 - if (parseInt(s_list.rank_switch) == 2 && end > now) { - var card_price = o[getApp().globalData.userInfo['card_field']]; - //如果会员有等级价 - if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null - && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) { - newd.goods_price = card_price; + + //-----如果是秒杀,团购,积分购,拼团,且不是普通购买----- + if (th.data.prom_type == 9 && th.data.is_normal != 1) { + newd.goods_price = th.data.prom_price; + newd.prom_type = th.data.prom_type; + newd.prom_id = th.data.prom_id; + //newd.kt_type = th.data.prom_act.kttype; //开团类型 + newd.is_pt_tz = 0; + //th.data.sto_sele_distr=1; //直接用自提的方式提交 + if (newd.kt_type > 1) { + newd.is_pt_tz = 1; //开团类型 + } + if (newd.kt_type == 3) { + th.data.sto_sele_distr = 1; } + } - } - } + // else if (th.data.prom_type == 3) { + // newd.prom_type = 0; + // newd.prom_id = 0; + // } - //-----如果是秒杀,团购,积分购,拼团,且不是普通购买----- - if (th.data.prom_type == 9 && th.data.is_normal != 1) { - newd.goods_price = th.data.prom_price; - newd.prom_type = th.data.prom_type; - newd.prom_id = th.data.prom_id; - //newd.kt_type = th.data.prom_act.kttype; //开团类型 - newd.is_pt_tz = 0; - //th.data.sto_sele_distr=1; //直接用自提的方式提交 - if (newd.kt_type > 1) { - newd.is_pt_tz = 1; //开团类型 - } - if (newd.kt_type == 3) { - th.data.sto_sele_distr = 1; + th.by_next_func(newd); } + + ) + }, + by_next_func(newd){ + var th=this; + newd['pick_name'] = th.data.sto_sele_name; + newd['pick_dis'] = th.data.sto_sele_distr; + newd['is_normal'] = th.data.is_normal; + + if (newd['is_normal']) { + newd['is_pd_normal'] = 1; + //判断一下有没有全局优惠活动 + th.buyNow(newd); + } + else { + // 点击立即参团 + th.buyNow_pt(newd); + } + }, + + //统一一下获取线下库存的函数 + async check_CanOutQty(goodsinfo, item, func) { + + var sales_rules = this.data.sales_rules; + //如果默认是商品 + if(getApp().is_virtual(goodsinfo)){ + return func(100000); + } + + var lock_rq = { + store_id: os.stoid, + wareId: goodsinfo.goods_id, + pageSize: 1000 + }; + + if (sales_rules == 2) { + lock_rq.storageId = item.pickup_id + } else { + lock_rq.appoint_pick_keyid = encodeURIComponent(this.data.appoint_pick_keyid) + } + + var lock = 0; + var CanOutQty = 0; + var plist = null; + //先读取门店的lock + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { + data: lock_rq + }).then(res => { + if (res.data.code == 0 && res.data.data.total > 0) { + for (var i in res.data.data.pageData) + lock += res.data.data.pageData[i].outQty; } + }) - // else if (th.data.prom_type == 3) { - // newd.prom_type = 0; - // newd.prom_id = 0; - // } + var sto_req = { + wareIds: encodeURIComponent(goodsinfo.erpwareid), + storeId: os.stoid + } + if (sales_rules == 2) { + sto_req.storageNos = item.pickup_no + } else { + sto_req.storageIds = encodeURIComponent(this.data.appoint_pick_keyid) + } - newd['pick_name'] = th.data.sto_sele_name; - newd['pick_dis'] = th.data.sto_sele_distr; - newd['is_normal'] = th.data.is_normal; - if (newd['is_normal']) { - newd['is_pd_normal'] = 1; - //判断一下有没有全局优惠活动 - th.buyNow(newd); + + //读取线下的门店库存 + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { + data: sto_req + }).then(res => { + if (res.data.code == 0 && res.data.data.total > 0) { + plist = res.data.data.pageData[0]; } - else { - // 点击立即参团 - th.buyNow_pt(newd); - }; }) + + if (plist && plist.CanOutQty - lock > 0) { + CanOutQty = plist.CanOutQty - lock; + } + + if (func) func(CanOutQty); + }, + + //----------立即购买_pt----------- buyNow_pt: function (e) { s.set_b_now(e); @@ -6225,7 +6357,7 @@ Page({ var url = '/api/weshop/activitylist/listGoodActInfo2New'; var req_d = { "store_id": os.stoid, - "goods_id": this.data.gid, + "goods_id": gid, "user_id": user_id, } await getApp().request.promiseGet(url, { @@ -6265,12 +6397,12 @@ Page({ } } - + var r_data=null; //调用接口判断订单优惠, await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gid + "/0" + "/" + user_id, { }).then(async res=>{ if (res.data.code == 0 && res.data.data) { - var r_data = res.data.data; + r_data = res.data.data; var max = 0, min = 0; //暂时积分够 不和 优惠,阶梯重叠 if(th.data.zh_act){ @@ -6295,42 +6427,6 @@ Page({ r_data.promGoodsLists=null; } - - if (r_data.ladderLists) { - var act_id = r_data.ladderLists[0].form_id; - //-- 判断会员能不能参与阶梯促销 -- - await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => { - if (res.data.code == 0 && res.data.data) { - var prom_content = ""; - - //暂定优惠促销还不能重叠 - if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){ - return false; - } - - if(res.data.data.good_object==1){ - r_data.promGoodsLists=null; - } - - for (let jj in r_data.ladderLists) { - if (r_data.ladderLists[jj].discount == 10) { - prom_content += "第" + (parseInt(jj) + 1) + "件原价,"; - } else { - prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,"; - } - } - prom_content = ut.sub_last(prom_content); - th.data.prom_type = 10; - th.data.prom_id = act_id; - th.setData({ - jieti_prom: prom_content, - ladder_act_id: act_id - }) - } - }) - } - - //普通购买不在界面显示 if(is_nor){ th.data.collocationGoods=r_data.collocationPromList; @@ -6346,8 +6442,49 @@ Page({ } }) + if (r_data && r_data.ladderLists) { + var act_id = r_data.ladderLists[0].form_id; + //-- 判断会员能不能参与阶梯促销 -- + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => { + if (res.data.code == 0 && res.data.data) { + var prom_content = ""; + //暂定优惠促销还不能重叠 + if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){ + return false; + } + if(res.data.data.good_object==1){ + r_data.promGoodsLists=null; + } + + for (let jj in r_data.ladderLists) { + if (r_data.ladderLists[jj].discount == 10) { + prom_content += "第" + (parseInt(jj) + 1) + "件原价,"; + } else { + prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,"; + } + } + prom_content = ut.sub_last(prom_content); + th.data.prom_type = 10; + th.data.prom_id = act_id; + th.setData({ + jieti_prom: prom_content, + ladder_act_id: act_id + }) + } + }) + } + + //-- 如果有促销活动也算是有参与活动,参与活动的也统一不进行计算起订的数量 -- + this.data.is_act=0; + if(this.data.zh_act || this.data.prom_goods || this.data.jieti_prom || this.data.collocationGoods ){ + this.data.is_act=1; + } + //-- 更新默认购买的数量 --- + var mo_num=getApp().get_limit_qty(th.data.sele_g,this.data.is_act); + this.setData({goodsInputNum:mo_num}) + this.setData({mo_num:mo_num}) }, @@ -6979,65 +7116,6 @@ Page({ }); }, - //统一一下获取线下库存的函数 - async check_CanOutQty(goodsinfo, item, func) { - - var sales_rules = this.data.sales_rules; - - var lock_rq = { - store_id: os.stoid, - wareId: goodsinfo.goods_id, - pageSize: 1000 - }; - - if (sales_rules == 2) { - lock_rq.storageId = item.pickup_id - } else { - lock_rq.appoint_pick_keyid = encodeURIComponent(this.data.appoint_pick_keyid) - } - - var lock = 0; - var CanOutQty = 0; - var plist = null; - //先读取门店的lock - await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { - data: lock_rq - }).then(res => { - if (res.data.code == 0 && res.data.data.total > 0) { - for (var i in res.data.data.pageData) - lock += res.data.data.pageData[i].outQty; - } - }) - - var sto_req = { - wareIds: encodeURIComponent(goodsinfo.erpwareid), - storeId: os.stoid - } - if (sales_rules == 2) { - sto_req.storageNos = item.pickup_no - } else { - sto_req.storageIds = encodeURIComponent(this.data.appoint_pick_keyid) - } - - - - //读取线下的门店库存 - await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { - data: sto_req - }).then(res => { - if (res.data.code == 0 && res.data.data.total > 0) { - plist = res.data.data.pageData[0]; - } - }) - - if (plist && plist.CanOutQty - lock > 0) { - CanOutQty = plist.CanOutQty - lock; - } - - if (func) func(CanOutQty); - - }, - async getUserBuyPromNum(prom_id){ var userInfo = getApp().globalData.userInfo; diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml index 3bd55de..1429ad6 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml @@ -436,7 +436,7 @@ (配送不匹配) - + (库存不足) @@ -1062,20 +1062,27 @@ + 11111111111111 已售:{{sele_g.sales_sum}} + - - 可售:{{def_pick_store.CanOutQty}} - - 可售:0 + + + + 可售:{{def_pick_store.CanOutQty}} + + 可售:0 + + 可售:{{sele_g.store_count}} + 555555555555 已售:{{prom_act.buy_num+prom_act.virtual}} @@ -1105,7 +1112,7 @@ (库存不足) (配送不匹配) - + (库存不足) @@ -1146,6 +1153,7 @@ ,送专享礼包 + 配送不匹配 @@ -1178,7 +1186,7 @@ - + 库存不足 @@ -1194,7 +1202,7 @@ - + 库存不足 diff --git a/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js b/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js index 31cd6c0..da9ecc7 100644 --- a/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js +++ b/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js @@ -82,7 +82,17 @@ Page({ r.order_status_detail="待支付"; r.pay_btn=1; } if (r.order_status == 1 && r.pay_status == 1 && r.shipping_status== 0) - r.order_status_detail = "待发货"; + { + //自提的话 + if (r.exp_type==1) + { + r.order_status_detail = "待自提"; + } + else + { + r.order_status_detail = "待发货"; + } + } if (r.order_status == 1 && r.pay_status == 1 && r.shipping_status == 1){ r.order_status_detail = "待收货";r.receive_btn=1; diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js index 0dad414..a31f25c 100644 --- a/packageC/pages/presell/cart/cart2.js +++ b/packageC/pages/presell/cart/cart2.js @@ -128,8 +128,8 @@ Page({ dis_config:null, bn_use_commission:0, //是不是使用佣金 - - same_ok:1 //同城配送按钮控制 + same_ok:1, + appoint_pick_keyid: '', }, onLoad: function (t) { @@ -248,7 +248,8 @@ Page({ sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics, - is_same_city: is_same_city + is_same_city: is_same_city, + appoint_pick_keyid: json_d.appoint_pick_keyid }); var rank_switch = json_d.rank_switch; @@ -1284,7 +1285,7 @@ Page({ if (gg.is_pd_normal) goods.is_pd_normal = 1; //如果不立即购买或者秒杀,如果是线下库存购买的时候 - if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 8 && th.data.sales_rules == 2) { + if ([1,2,4,6,8,9].indexOf(goods.prom_type)== -1 && th.data.sales_rules >= 2 && !th.data.bn_goods.whsle_id && !getApp().is_virtual(th.data.bn_goods)) { var isok = 1; await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { isok = res; @@ -1552,7 +1553,7 @@ Page({ } //如果不立即购买或者秒杀,如果是线下库存购买的时候 - if (goods.prom_type == 0 && th.data.sales_rules == 2) { + if (goods.prom_type == 0 && th.data.sales_rules >= 2 && !g_item.whsle_id && !getApp().is_virtual(g_item)) { var isok = 1; await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { isok = res; @@ -1729,26 +1730,38 @@ Page({ }) }, + + + //---确认线下门店的数量足不足--- async check_store_num(goods_id, pick, goods_num, func) { var lock = 0, pick_no, plist, erpwareid; + + var lock_rq = { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 }; + if (this.data.sales_rules == 3) { + lock_rq.appoint_pick_keyid = this.data.appoint_pick_keyid; + delete lock_rq.storageId + } //先读取门店的lock await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { - data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 } + data:lock_rq }).then(res => { if (res.data.code == 0 && res.data.data.total > 0) { for (var i in res.data.data.pageData) lock += res.data.data.pageData[i].outQty; } }) - //先获取门店的编号 - await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { - data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } - }).then(res => { - if (res.data.code == 0) { - pick_no = res.data.data.pickup_no; - } - }) + + if (this.data.sales_rules == 2) { + //先获取门店的编号 + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { + data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} + }).then(res => { + if (res.data.code == 0) { + pick_no = res.data.data.pickup_no; + } + }) + } //先获取商品的线下库存 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } @@ -1757,9 +1770,16 @@ Page({ erpwareid = res.data.data.erpwareid; } }) + + var sto_rq = { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 }; + if (this.data.sales_rules == 3) { + sto_rq.storageIds = this.data.appoint_pick_keyid; + delete sto_rq.storageNos + } + //读取线下的门店库存 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { - data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 } + data: sto_rq }).then(res => { if (res.data.code == 0) { plist = res.data.data.pageData[0]; diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index aa70361..47c0561 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -395,6 +395,8 @@ Page({ is_closecoupon: json_d.is_closecoupon, is_newsales_rules: json_d.is_newsales_rules, is_retail_price: json_d.is_retail_price || 0, + appoint_pick_keyid: json_d.appoint_pick_keyid + }); // ee.init(gid); //------几人评价------- @@ -1992,7 +1994,8 @@ Page({ th.setData({ all_pick_list: e.data.data.pageData }); //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售-- - if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4 && th.data.prom_type != 8) || is_normal == 1)) { + if(!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id + && th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ([1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 || is_normal == 1)) { setTimeout(function () { th.deal_pickup_dline(e); }, 800) @@ -2199,7 +2202,8 @@ Page({ //------------处理线下门店库存-------- deal_pickup_dline(e) { - var pkno = [], th = this; + var pkno = [], + th = this; if (!th.data.sele_g) return false; if (this.data.def_pick_store) { @@ -2219,78 +2223,165 @@ Page({ var g_distr_type = th.data.sele_g.distr_type; var lock = []; + + var lock_rq = { + store_id: os.stoid, + wareId: th.data.sele_g.goods_id, + pageSize: 1000 + }; + + if (th.data.sales_rules == 3) { + lock_rq.appoint_pick_keyid = th.data.appoint_pick_keyid; + } + //先读取门店的lock,采用链式写法,少用await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { - data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, pageSize: 1000 } + data: lock_rq }).then(res => { if (res.data.code == 0 && res.data.data.total > 0) { lock = res.data.data.pageData } + var sto_rq = { + wareIds: encodeURIComponent(th.data.sele_g.erpwareid), + storeId: os.stoid, + pageSize: 2000 + } + + if (th.data.sales_rules == 3) { + sto_rq.storageIds = th.data.appoint_pick_keyid; + } else { + sto_rq.storageNos = pkno_str; + } + + //---通过接口获取门店的线下库存信息-- return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { - data: { storageNos: pkno_str, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid, pageSize: 2000 } + data: sto_rq }) }).then(res => { wx.hideLoading(); if (res.data.code == 0) { + if (res.data.data.pageData && res.data.data.pageData.length > 0) { - var plist = res.data.data.pageData; + var def_pick_store = th.data.def_pick_store; - //以原来的数组为外循环,保证距离的顺序 - for (var kk in o_plist) { - for (var ii in plist) { - //线下的门店小心 - var n_item = plist[ii]; - if (n_item.StorageNo == o_plist[kk].pickup_no) { - - //拿到锁库的数量 - var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock); - //可出库数大于预出库库存的数量,可以判断为有库存 - if (n_item.CanOutQty > lock_num) { - o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num; - new_list.push(o_plist[kk]); - //--如果找到默认门店,同时也应该判断配送方式对不对-- - if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { - th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num; - if (def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) - th.setData({ def_pick_store: th.data.fir_def_store }) - is_find_def_store = 1; + var plist = res.data.data.pageData; + if (th.data.sales_rules == 3) { + var lock_num = 0; + var Qty = 0; + //-- 计算锁住的库存 -- + for (var i in lock) lock_num += lock[i].outQty; + Qty = plist[0].CanOutQty - lock_num; + + if (Qty > 0) { + for (var kk in o_plist) { + o_plist[kk].CanOutQty = Qty; + new_list.push(o_plist[kk]); + } + if (th.data.fir_def_store && + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || (th.data.def_pick_store && th.data.def_pick_store.distr_type == g_distr_type))) { + th.data.fir_def_store.Qty=Qty; + if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) + th.setData({ + def_pick_store: th.data.fir_def_store + }) + is_find_def_store = 1; + } + + } else { + th.setData({ + all_sto: null, + only_pk: null, + def_pickpu_list: null + }); + return false; + } + + } else { + + + //以原来的数组为外循环,保证距离的顺序 + for (var kk in o_plist) { + for (var ii in plist) { + //线下的门店小心 + var n_item = plist[ii]; + if (n_item.StorageNo == o_plist[kk].pickup_no) { + + //拿到锁库的数量 + var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock); + //可出库数大于预出库库存的数量,可以判断为有库存 + if (n_item.CanOutQty > lock_num) { + o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num; + new_list.push(o_plist[kk]); + //--如果找到默认门店,同时也应该判断配送方式对不对-- + if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { + th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num; + if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) + th.setData({ + def_pick_store: th.data.fir_def_store + }) + is_find_def_store = 1; + } } + break; } - break; } } + } //数据组装下 - var em = {}; em.data = {}; em.data.data = {}; + var em = {}; + em.data = {}; + em.data.data = {}; em.data.data.total = new_list.length; em.data.data.pageData = new_list; + //--如果找到默认门店,同时也应该判断配送方式对不对-- - if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { + if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id && + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { th.data.fir_def_store.CanOutQty = 0; //--当选择的门店是客户默认的门店的时候-- if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) { - th.setData({ def_pick_store: th.data.fir_def_store }); + th.setData({ + def_pick_store: th.data.fir_def_store + }); em.data.data.pageData.unshift(th.data.def_pick_store); } else { em.data.data.pageData.splice(1, 0, th.data.fir_def_store); } } + for (let j = 0; j < em.data.data.pageData.length; j++) { + var iu = em.data.data.pageData[j]; + if (iu.CanOutQty <= 0) iu.is_no_qyt = 1; + + } + //---把数组组装进去--- th.deal_pickup(em); + } else { - th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) + th.setData({ + all_sto: null, + only_pk: null, + def_pickpu_list: null + }) } + } else { - th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) + th.setData({ + all_sto: null, + only_pk: null, + def_pickpu_list: null + }) } }) }, + find_lock_num(pick_id, lock) { var lock_num = 0; if (!lock) return 0; diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml index 8fde05a..3c52dfc 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml +++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml @@ -194,7 +194,7 @@ (配送不匹配2) - + (库存不足) @@ -630,7 +630,7 @@ (库存不足) (配送不匹配1) - + (库存不足) diff --git a/packageC/pages/presell/list/list.wxml b/packageC/pages/presell/list/list.wxml index 92486e1..6bc2abf 100644 --- a/packageC/pages/presell/list/list.wxml +++ b/packageC/pages/presell/list/list.wxml @@ -33,7 +33,7 @@ {{item.goods_name}} + url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">{{item.goods_name}} diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.js b/packageC/pages/presell/pregoodsInfo/goodsInfo.js index c687687..8542103 100644 --- a/packageC/pages/presell/pregoodsInfo/goodsInfo.js +++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.js @@ -1916,7 +1916,7 @@ Page({ th.setData({ all_pick_list: e.data.data.pageData }); //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- - if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { + if (th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { setTimeout(function () { th.deal_pickup_dline(e); }, 800) @@ -2121,9 +2121,10 @@ Page({ } }, - //------------处理线下门店库存-------- + //------------处理线下门店库存-------- deal_pickup_dline(e) { - var pkno = [], th = this; + var pkno = [], + th = this; if (!th.data.sele_g) return false; if (this.data.def_pick_store) { @@ -2143,78 +2144,166 @@ Page({ var g_distr_type = th.data.sele_g.distr_type; var lock = []; + + var lock_rq = { + store_id: os.stoid, + wareId: th.data.sele_g.goods_id, + pageSize: 1000 + }; + + if (th.data.sales_rules == 3) { + lock_rq.appoint_pick_keyid = th.data.appoint_pick_keyid; + } + //先读取门店的lock,采用链式写法,少用await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { - data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, pageSize: 1000 } + data: lock_rq }).then(res => { if (res.data.code == 0 && res.data.data.total > 0) { lock = res.data.data.pageData } + var sto_rq = { + wareIds: encodeURIComponent(th.data.sele_g.erpwareid), + storeId: os.stoid, + pageSize: 2000 + } + + if (th.data.sales_rules == 3) { + sto_rq.storageIds = th.data.appoint_pick_keyid; + } else { + sto_rq.storageNos = pkno_str; + } + + //---通过接口获取门店的线下库存信息-- return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { - data: { storageNos: pkno_str, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid, pageSize: 2000 } + data: sto_rq }) }).then(res => { wx.hideLoading(); if (res.data.code == 0) { + if (res.data.data.pageData && res.data.data.pageData.length > 0) { - var plist = res.data.data.pageData; + var def_pick_store = th.data.def_pick_store; - //以原来的数组为外循环,保证距离的顺序 - for (var kk in o_plist) { - for (var ii in plist) { - //线下的门店小心 - var n_item = plist[ii]; - if (n_item.StorageNo == o_plist[kk].pickup_no) { - - //拿到锁库的数量 - var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock); - //可出库数大于预出库库存的数量,可以判断为有库存 - if (n_item.CanOutQty > lock_num) { - o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num; - new_list.push(o_plist[kk]); - //--如果找到默认门店,同时也应该判断配送方式对不对-- - if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { - th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num; - if (def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) - th.setData({ def_pick_store: th.data.fir_def_store }) - is_find_def_store = 1; + var plist = res.data.data.pageData; + if (th.data.sales_rules == 3) { + var lock_num = 0; + var Qty = 0; + //-- 计算锁住的库存 -- + for (var i in lock) lock_num += lock[i].outQty; + Qty = plist[0].CanOutQty - lock_num; + + if (Qty > 0) { + for (var kk in o_plist) { + o_plist[kk].CanOutQty = Qty; + new_list.push(o_plist[kk]); + } + if (th.data.fir_def_store && + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || (th.data.def_pick_store && th.data.def_pick_store.distr_type == g_distr_type))) { + th.data.fir_def_store.Qty=Qty; + if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) + th.setData({ + def_pick_store: th.data.fir_def_store + }) + is_find_def_store = 1; + } + + } else { + th.setData({ + all_sto: null, + only_pk: null, + def_pickpu_list: null + }); + return false; + } + + } else { + + + //以原来的数组为外循环,保证距离的顺序 + for (var kk in o_plist) { + for (var ii in plist) { + //线下的门店小心 + var n_item = plist[ii]; + if (n_item.StorageNo == o_plist[kk].pickup_no) { + + //拿到锁库的数量 + var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock); + //可出库数大于预出库库存的数量,可以判断为有库存 + if (n_item.CanOutQty > lock_num) { + o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num; + new_list.push(o_plist[kk]); + //--如果找到默认门店,同时也应该判断配送方式对不对-- + if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { + th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num; + if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) + th.setData({ + def_pick_store: th.data.fir_def_store + }) + is_find_def_store = 1; + } } + break; } - break; } } + } //数据组装下 - var em = {}; em.data = {}; em.data.data = {}; + var em = {}; + em.data = {}; + em.data.data = {}; em.data.data.total = new_list.length; em.data.data.pageData = new_list; + //--如果找到默认门店,同时也应该判断配送方式对不对-- - if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { + if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id && + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { th.data.fir_def_store.CanOutQty = 0; //--当选择的门店是客户默认的门店的时候-- if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) { - th.setData({ def_pick_store: th.data.fir_def_store }); + th.setData({ + def_pick_store: th.data.fir_def_store + }); em.data.data.pageData.unshift(th.data.def_pick_store); } else { em.data.data.pageData.splice(1, 0, th.data.fir_def_store); } } + for (let j = 0; j < em.data.data.pageData.length; j++) { + var iu = em.data.data.pageData[j]; + if (iu.CanOutQty <= 0) iu.is_no_qyt = 1; + + } + //---把数组组装进去--- th.deal_pickup(em); + } else { - th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) + th.setData({ + all_sto: null, + only_pk: null, + def_pickpu_list: null + }) } + } else { - th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) + th.setData({ + all_sto: null, + only_pk: null, + def_pickpu_list: null + }) } }) }, + + find_lock_num(pick_id, lock) { var lock_num = 0; if (!lock) return 0; diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.wxml b/packageC/pages/presell/pregoodsInfo/goodsInfo.wxml index 53f3938..c079331 100644 --- a/packageC/pages/presell/pregoodsInfo/goodsInfo.wxml +++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.wxml @@ -603,7 +603,7 @@ (库存不足) (配送不匹配1) - + (库存不足) diff --git a/packageD/pages/AI-test-skin/analyse/analyse.js b/packageD/pages/AI-test-skin/analyse/analyse.js index 52775d1..fd10228 100644 --- a/packageD/pages/AI-test-skin/analyse/analyse.js +++ b/packageD/pages/AI-test-skin/analyse/analyse.js @@ -26,6 +26,7 @@ Page({ err_map: null, skin_type: 0, ce_user_id:0, + img_remark:'' }, /** @@ -36,6 +37,7 @@ Page({ var plugin = requirePlugin('mtSkinSdk') plugin.setConfig(pluginGD) } + this.setData({img_remark:options.img_remark}) if(options.ce_user_id) this.data.ce_user_id=options.ce_user_id; @@ -519,6 +521,7 @@ Page({ resultjson: JSON.stringify(analyse_data), detectjson: JSON.stringify(analyse_info), skin_type: 1, + img_remark:th.data.img_remark } //要保存一下分析的结果 th.json_post("/api/weshop/face/storeSkinface/save", req_data, function (res) { @@ -556,6 +559,8 @@ Page({ resultjson: JSON.stringify(res.data.data), detectjson: JSON.stringify(th.data.check_data), skin_type: 0, + img_remark:th.data.img_remark + } var txt=[]; diff --git a/packageD/pages/AI-test-skin/history_record/history_record.js b/packageD/pages/AI-test-skin/history_record/history_record.js index 640e4cb..fb2abf6 100644 --- a/packageD/pages/AI-test-skin/history_record/history_record.js +++ b/packageD/pages/AI-test-skin/history_record/history_record.js @@ -203,6 +203,7 @@ Page({ for (let i = 0; i < data.length; i++) { let history = data[i]; let id = history.id; + let img_remark = history.img_remark; let now = new Date(history['addtime'] * 1000); let year = now.getFullYear(); //年 let month = (now.getMonth() + 1).toString().padStart(2, 0); //月 @@ -218,10 +219,12 @@ Page({ let obj = { time, id, + img_remark, }; if (arr.length > 0) { let index = arr.findIndex(item => { return item['history_time'] === history_time; + }) if (index > -1) { arr[index]['time_arr'].push(obj); diff --git a/packageD/pages/AI-test-skin/history_record/history_record.wxml b/packageD/pages/AI-test-skin/history_record/history_record.wxml index 4fd17de..2410a79 100644 --- a/packageD/pages/AI-test-skin/history_record/history_record.wxml +++ b/packageD/pages/AI-test-skin/history_record/history_record.wxml @@ -14,9 +14,14 @@ {{item.history_time}} - + + + {{subitem.img_remark}} + {{subitem.time}} 去查看 + + diff --git a/packageD/pages/AI-test-skin/select_photo/select_photo.js b/packageD/pages/AI-test-skin/select_photo/select_photo.js index f727d19..ab9dc5e 100644 --- a/packageD/pages/AI-test-skin/select_photo/select_photo.js +++ b/packageD/pages/AI-test-skin/select_photo/select_photo.js @@ -13,7 +13,8 @@ Page({ iurl: setting.imghost, gl_skin_img: null, skin_type: 0, - ce_user_id:0 + ce_user_id:0, + img_remark:'' }, /** @@ -40,9 +41,13 @@ Page({ if (e.data.code == 0) { getApp().globalData.face_img = e.data.data.img; getApp().globalData.face_SourceImg = e.data.data.SourceImg; - let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页 + var getimg_remark=th.data.img_remark; + + + let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页 + url+="?img_remark="+getimg_remark; if(th.data.ce_user_id) - url+="?ce_user_id="+th.data.ce_user_id; + url+="&ce_user_id="+th.data.ce_user_id; console.log("select_ph"); console.log(url); @@ -60,6 +65,20 @@ Page({ }) }, + + getInput(e) { + let val = e.detail.value; + if (val) { + this.setData({ + img_remark: e.detail.value, + }); + } else { + this.setData({ + img_remark: '', + }); + } + + }, //-- 重新从相册中选择图片 -- show_pai_pop: function () { var th = this; diff --git a/packageD/pages/AI-test-skin/select_photo/select_photo.wxml b/packageD/pages/AI-test-skin/select_photo/select_photo.wxml index 3c33116..a3219dd 100644 --- a/packageD/pages/AI-test-skin/select_photo/select_photo.wxml +++ b/packageD/pages/AI-test-skin/select_photo/select_photo.wxml @@ -1,8 +1,13 @@ - + + + + + + diff --git a/packageD/pages/AI-test-skin/select_photo/select_photo.wxss b/packageD/pages/AI-test-skin/select_photo/select_photo.wxss index 3bb701c..e12925c 100644 --- a/packageD/pages/AI-test-skin/select_photo/select_photo.wxss +++ b/packageD/pages/AI-test-skin/select_photo/select_photo.wxss @@ -28,3 +28,13 @@ page { /* margin: 0 auto; */ color: #fff; } + +.inputclass{ + width: 540rpx; + height: 55rpx; + line-height: 55rpx; + background-color: rgb(238, 238, 238); + border-radius: 6rpx; + padding-left: 40rpx; + padding-right: 15rpx; +} \ No newline at end of file diff --git a/packageD/pages/shop/order_detail/order_detail.js b/packageD/pages/shop/order_detail/order_detail.js index 3024a05..ae977c1 100644 --- a/packageD/pages/shop/order_detail/order_detail.js +++ b/packageD/pages/shop/order_detail/order_detail.js @@ -46,8 +46,17 @@ Page({ if (r.order_status == 0 && r.pay_status==0 ){ r.order_status_detail="待支付"; r.pay_btn=1; } - if (r.order_status == 1 && r.pay_status == 1 && r.shipping_status== 0) - r.order_status_detail = "待发货"; + if (r.order_status == 1 && r.pay_status == 1 && r.shipping_status== 0){ + //自提的话 + if (r.exp_type==1) + { + r.order_status_detail = "待自提"; + } + else + { + r.order_status_detail = "待发货"; + } + } if (r.order_status == 1 && r.pay_status == 1 && r.shipping_status == 1){ r.order_status_detail = "待收货";r.receive_btn=1; @@ -107,8 +116,7 @@ Page({ //------------对比一下有没有退款记录------------ await getApp().request.promiseGet("/api/weshop/order/returngoods/page",{ - data: { order_id: r.order_id, store_id: os.stoid, - user_id:oo.user_id, pageSize: 20 } + data: { order_id: r.order_id, store_id: os.stoid,pageSize: 20 } }).then(rs=>{ var ttd=rs; //--看一下订单的总数量-- diff --git a/packageD/pages/shop/order_detail/order_detail.wxml b/packageD/pages/shop/order_detail/order_detail.wxml index c792ebf..3ef1ec1 100644 --- a/packageD/pages/shop/order_detail/order_detail.wxml +++ b/packageD/pages/shop/order_detail/order_detail.wxml @@ -37,13 +37,13 @@ - 申请退款 - 申请退款 --> + 退款中 - 重新退款 - 重新退款 --> + 退款完成 diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index a101c3a..b15a1fe 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -5,7 +5,7 @@ var regeneratorRuntime = require('../../../../utils/runtime.js'); var util_pay = require("../../../../utils/pay.js"); var zh_calc = require("zh_calculate.js"); var ladder_calc = require("ladder_calculate.js"); -// 防抖函数用定时器 +// 防抖函数用定时器 let timer; Page({ data: { @@ -137,6 +137,7 @@ Page({ show_duo_gift: 0, send_gf: {}, //多赠品的计算 send_lb: {}, + month_lb: {}, //每月礼包数据 dis_config: null, bn_use_commission: 0, //是不是使用佣金 cart_use_commission: 0, @@ -198,6 +199,7 @@ Page({ is_by: {}, send_gf: {}, send_lb: {}, + month_lb: {}, }) }, @@ -1831,6 +1833,7 @@ Page({ }, calc_per: async function (c_arr) { + var send_gf = {}; var duo_zp_num_arr = {}; var th = this; @@ -1856,7 +1859,7 @@ Page({ for (var ii in ob) { var item_map = ob[ii]; if (item_map.bs == undefined || item_map.bs == null) { - //等待,获取一下优惠活动的信息 + //等待,获取一下优惠活动的信息 await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { data: { price: parseFloat(item_map.price).toFixed(2), prom_id: item_map.prom_id, @@ -1875,7 +1878,9 @@ Page({ item_map.s_coupon_num = get_data.coupon_num; item_map.lbtitle = get_data.lbtitle; item_map.zxlbtitle = get_data.zxlbtitle; - + //每月礼包 + item_map.monthlbtitle = get_data.monthlbtitle; + //------end------- if (get_data.gift_id && parseInt(get_data.zp_mode) != 1 && get_data.zp_num * item_map.bs <= get_data.limit_num && get_data.zp_num * item_map.bs <= get_data.gift_storecount @@ -1901,6 +1906,10 @@ Page({ //专享礼包 item_map.zx_libao = get_data.zxlibao; item_map.zx_lb_num = get_data.zxlb_num; + //每月礼包 + item_map.monthlibao = get_data.monthlibao; + item_map.monthlb_num = get_data.monthlb_num; + //------end------- if (parseInt(get_data.zp_mode) == 1) { if (!send_gf[pickid]) send_gf[pickid] = []; @@ -2043,11 +2052,22 @@ Page({ cart_item.g_zxlb_num.push({ 'l_id': item_map.zx_libao, "num": item_map.zx_lb_num, 'zxlbtitle': item_map.zxlbtitle }) } } + //每月礼包 + if (item_map.monthlibao) { + if (!cart_item.monthlibao) { + cart_item.monthlibao = item_map.monthlibao + ""; + cart_item.g_monthlb_num = [{ 'month_id': item_map.monthlibao, "monthnum": item_map.monthlb_num, 'monthlbtitle': item_map.monthlbtitle }]; + } else { + cart_item.monthlibao += "," + item_map.monthlibao; + cart_item.g_monthlb_num.push({ 'month_id': item_map.monthlibao, "monthnum": item_map.monthlb_num, 'monthlbtitle': item_map.monthlbtitle }) + } + } + //------------end-------- } } } - + var arr = Object.keys(send_gf); var arr2 = Object.keys(th.data.send_gf); if (arr2.length > 0) return false; @@ -2062,10 +2082,12 @@ Page({ calclate_lbNum(r_data) { - + if(!r_data) return false; let send_lb = this.data.send_lb; + let month_lb = this.data.month_lb; + //g_lb_num我的礼包 g_zxlb_num专享礼包 r_data.forEach(r_d => { let arr = []; @@ -2112,9 +2134,35 @@ Page({ send_lb[r_d.pickup_id] = arr; } } + //每月礼包 + let monthArr=[] + if (r_d.g_monthlb_num) { + let g_lb = r_d.g_monthlb_num; + for (let i = 0; i < g_lb.length; i++) { + let item = g_lb[i]; + let new_lb = g_lb.filter(lb => { + return item.month_id === lb.month_id; + }); + if (new_lb.length == 1) { + monthArr.push(item); + } else { + item.num = new_lb.reduce((pre, next) => { + return pre + next.num; + }, 0); + monthArr.push(item); + g_lb = g_lb.filter(ii => { + return ii.month_id !== item.month_id; + }); + } + month_lb[r_d.pickup_id] = monthArr; + } + } + //-----end-------- + }) this.setData({ send_lb, + month_lb }) }, @@ -3633,6 +3681,15 @@ Page({ ob = JSON.stringify(ob); th.setData({ [l_txt]: good.zx_libao, [l_txt1]: ob }); } + //每月礼包 + if (good.month_libao) { + var l_txt = "formData.give_monthlb_id"; + //这个是json格式的 + var l_txt1 = "formData.g_monthlb_num"; + var ob = [{ "num": good.month_lb_num, "l_id": good.month_libao }]; + ob = JSON.stringify(ob); + th.setData({ [l_txt]: good.month_libao, [l_txt1]: ob }); + } wx.hideLoading(); @@ -3918,6 +3975,12 @@ Page({ order_prom_list.give_zxlb_id = th.data.formData.give_zxlb_id; order_prom_list.g_zxlb_num = th.data.formData.g_zxlb_num; } + //--- 每月礼包 --- + if (th.data.formData.give_monthlb_id > 0) { + order_prom_list.give_monthlb_id = th.data.formData.give_monthlb_id; + order_prom_list.g_monthlb_num = th.data.formData.g_monthlb_num; + // order_prom_list.g_monthlb_num = [{ "num": good.month_lb_num, "l_id": th.data.formData.month_libao_id }]; + } item.order_prom_list = order_prom_list; @@ -4000,8 +4063,26 @@ Page({ } + var act=await getApp().get_has_cx_act(th.data.bn_goods.goods_id); + var mo_num=getApp().get_limit_qty(th.data.bn_goods,act.length); + var steep=getApp().get_limit_qty(th.data.bn_goods,act.length,1); + + if ([0,3,5,7,10].indexOf(goods.prom_type)>-1){ + if(mo_num>goods.goods_num){ + getApp().confirmBox(goods.goods_name + "的未达到起订数量"); + th.data.is_summit_ing = 0; + return false; + } + if(steep>1 && (goods.goods_num-mo_num)%steep!=0 ){ + getApp().confirmBox(goods.goods_name + "的购买的数量不是起订量的倍数"); + th.data.is_summit_ing = 0; + return false; + } + } + //如果不立即购买或者秒杀,如果是线下库存购买的时候 - if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2 && th.data.sales_rules >= 2 && !th.data.bn_goods.whsle_id) { + if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2 + && th.data.sales_rules >= 2 && !th.data.bn_goods.whsle_id && !getApp().is_virtual(th.data.bn_goods)) { var isok = 1; await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { isok = res; @@ -4124,7 +4205,6 @@ Page({ var order_prom_list_cart = th.data.order_prom_list_cart; - //--组装推送数据-- for (var i = 0; i < order_prom_list_cart.length; i++) { var t_item = order_prom_list_cart[i]; @@ -4227,6 +4307,23 @@ Page({ order_prom_list.g_zxlb_num = JSON.stringify(t_item.g_zxlb_num); } + //-- 送每月礼包的时候 -- + if (t_item.monthlibao) { + order_prom_list.give_monthlb_id = t_item.monthlibao; + let marr=[]; + if (t_item.g_monthlb_num && t_item.g_monthlb_num.length>0) { + t_item.g_monthlb_num.map(ite=>{ + let obj={ + num:ite.monthnum, + l_id:ite.month_id, + monthlbtitle:ite.monthlbtitle + } + marr.push(obj) + }) + } + order_prom_list.g_monthlb_num = JSON.stringify(marr); + } + if (Object.keys(order_prom_list).length > 0) { if (order_prom_list.discount_amount) order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2); @@ -4347,8 +4444,28 @@ Page({ check_map[txt] = 1; } - //如果不立即购买或者秒杀,如果是线下库存购买的时候 - if (goods.prom_type == 0 && th.data.sales_rules >= 2) { + goods.prom_type=parseInt(goods.prom_type+''); + + var act=await getApp().get_has_cx_act(g_item.goods_id); + var mo_num=getApp().get_limit_qty(g_item,act.length); + var steep=getApp().get_limit_qty(g_item,act.length,1); + + if ([0,3,5,7,10].indexOf(goods.prom_type)>-1){ + if(mo_num>goods.goods_num){ + getApp().confirmBox(goods.goods_name + "的未达到起订数量"); + th.data.is_summit_ing = 0; + return false; + } + if(steep>1 && (goods.goods_num-mo_num)%steep!=0 ){ + getApp().confirmBox(goods.goods_name + "的购买的数量不是起订量的倍数"); + th.data.is_summit_ing = 0; + return false; + } + + } + + //如果不立即购买或者秒杀,如果是线下库存购买的时候 + if ([0,3,5,7,10].indexOf(goods.prom_type)>-1 && th.data.sales_rules >= 2 && !g_item.whsle_id && !getApp().is_virtual(g_item) ) { var isok = 1; await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { isok = res; @@ -4535,10 +4652,10 @@ Page({ }) // pdata.keyid = th.data.bn_goods.keyid } - + // debugger var str = JSON.stringify(pdata); console.log(str,'aaaaaaaaaaaaaaa'); - //return false; + // return false; wx.showLoading({ title: "加载中" }); th.setData({ submit: 1, }) @@ -5819,6 +5936,7 @@ Page({ } }).then(res => { if (res.data.code == 0) { + var get_data = res.data.data; arr.is_bz = prom.is_bz; //是不是倍增 arr.is_xz_yh = arr.is_xz_yh ? arr.is_xz_yh : prom.is_xz_yh; //是不是优惠 @@ -5856,6 +5974,11 @@ Page({ arr.zxlbtitle = get_data.zxlbtitle; arr.zx_libao = get_data.zxlibao; arr.zx_lb_num = get_data.zxlb_num; + //立即购买,每月礼包 + arr.monthlbtitle = get_data.monthlbtitle; + arr.month_libao = get_data.monthlibao; + arr.month_lb_num = get_data.monthlb_num; + //----end------- arr.prom_id = prom_id; @@ -6053,6 +6176,7 @@ Page({ check_is_youhui: function (r_data, pick_id) { let send_lb = this.data.send_lb; let lodash = null; + r_data.forEach(item => { if (send_lb[pick_id]) { for (let i = 0; i < send_lb[pick_id].length; i++) { @@ -6192,10 +6316,14 @@ Page({ let id = e.currentTarget.dataset.id; // 获取礼包id let flag = e.currentTarget.dataset.flag; let url = ''; - if (flag == 1) { // flag =1 控制跳转到专享礼包 - url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; - } else { + + if (flag == 2) { // flag =2 控制跳转到每月礼包 + // url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; + url = `/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo?isBuy=1&id=${id}&is_act=1`; + }else if (flag == 1) { url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮 + } else { + url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; }; // console.log('myurl', url); getApp().goto(url); diff --git a/packageE/pages/cart/cart2/cart2.wxml b/packageE/pages/cart/cart2/cart2.wxml index 45ff5f7..4144db3 100644 --- a/packageE/pages/cart/cart2/cart2.wxml +++ b/packageE/pages/cart/cart2/cart2.wxml @@ -209,7 +209,7 @@ - + {{send.zxlbtitle?send.zxlbtitle:send.lbtitle}} @@ -220,6 +220,20 @@ + + + + + + {{send.monthlbtitle}} + + + + x{{send.monthnum}} + + + + @@ -416,7 +430,7 @@ - + {{bn_goods.lbtitle}} @@ -428,7 +442,7 @@ - + {{bn_goods.zxlbtitle}} @@ -438,6 +452,18 @@ + + + + + {{bn_goods.monthlbtitle}} + + + + x{{bn_goods.month_lb_num}} + + + diff --git a/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxss b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxss index e5edddf..cdede7f 100644 --- a/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxss +++ b/packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxss @@ -92,7 +92,8 @@ .box_ware_img image.data-v-3a5b7e36 { /* width: 185rpx; height: 190rpx; *//* background-color: rgba(138, 138, 138, 0.63); */ - border: 2rpx solid #999; + border: 2rpx solid #fafaf9; + border-radius: 4rpx; width: 120rpx; height: 120rpx; background-color: #f8f8f8; diff --git a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js index 752fa44..ff8c348 100644 --- a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js +++ b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js @@ -297,7 +297,8 @@ Page({ page: th.data.curpage, pageSize: th.data.pageSize, is_end:0, - timetype:1 + timetype:1, + is_act:0 }, success: function (res) { if (res.data.code == 0) { diff --git a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js index 2fc2187..47f2922 100644 --- a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js +++ b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js @@ -214,6 +214,43 @@ Page({ url: '/packageE/pages/togoin/togoin', }) }, + getListInfo: function (e) { + var th = this; + getApp().request.get(`/api/weshop/marketing/marketingMonthgiftbagForm/get/${a.stoid}/${th.data.params.id}`, { + isShowLoading: true, + data: { + // store_id: a.stoid, //商家ID + // user_id: d.user_id, //用户ID + // page: 1, + // pageSize: 10, + // is_end:0, + // timetype:1, + // id:th.data.params.id + }, + success: function (res) { + if (res.data.code == 0) { + // th.data.curpage++; + // var arr1 = th.data.wareCard; + let obj = res.data.data; + let monthgiftbag={ + remark:obj.remark, + cover_img:obj.imageurl, + giftTitle:obj.act_name, + lbPrice:obj.oldPrice + } + let remark=monthgiftbag.remark.replace(/\{ diff --git a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml index 25a24ee..a852b38 100644 --- a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml +++ b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml @@ -149,7 +149,7 @@ - + @@ -229,7 +229,9 @@ - + + + diff --git a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxss b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxss index 28bd743..0977920 100644 --- a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxss +++ b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxss @@ -92,7 +92,8 @@ .box_ware_img image.data-v-3a5b7e36 { /* width: 185rpx; height: 190rpx; *//* background-color: rgba(138, 138, 138, 0.63); */ - border: 2rpx solid #999; + border: 2rpx solid #fafaf9; + border-radius: 4rpx; width: 120rpx; height: 120rpx; background-color: #f8f8f8; diff --git a/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.wxss b/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.wxss index 28bd743..0977920 100644 --- a/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.wxss +++ b/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.wxss @@ -92,7 +92,8 @@ .box_ware_img image.data-v-3a5b7e36 { /* width: 185rpx; height: 190rpx; *//* background-color: rgba(138, 138, 138, 0.63); */ - border: 2rpx solid #999; + border: 2rpx solid #fafaf9; + border-radius: 4rpx; width: 120rpx; height: 120rpx; background-color: #f8f8f8; diff --git a/packageE/pages/user/nick_avatar_add/nick_avatar_add.js b/packageE/pages/user/nick_avatar_add/nick_avatar_add.js new file mode 100644 index 0000000..22a200c --- /dev/null +++ b/packageE/pages/user/nick_avatar_add/nick_avatar_add.js @@ -0,0 +1,137 @@ +// pages/user/userfw/userfw.js +var e = getApp(), os = e.globalData.setting; +var utils = require('../../../../utils/util.js'); +var regeneratorRuntime = require('../../../../utils/runtime.js'); + + +Page({ + /** + * 页面的初始数据 + */ + data: { + defaultAvatar: os.imghost + "/miniapp/images/no-head.jpg", + ob: {}, + load: 0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if(getApp().globalData.up_nick_avatar){ + this.setData({ + ob: JSON.parse(JSON.stringify(getApp().globalData.up_nick_avatar)) + }) + getApp().globalData.up_nick_avatar=null; + } + + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: async function () { + + }, + + + onChooseAvatar: function (e) { + console.log(e, 1111); + var th = this; + getApp().request.uploadFile(os.url + "/api/weshop/comment/uploadCommentImg", { + filePath: e.detail.avatarUrl, + name: "file", + success: function (t) { + var u = t.data.data; + th.setData({'ob.head_pic': u}) + } + }); + + }, + + get_val: function (e) { + console.log(e, 2222); + this.setData({'ob.nickname': e.detail.value}) + }, + + save_data() { + + var that=this; + setTimeout(()=>{ + if (!this.data.ob.head_pic) { + wx.showToast({ + title: '请选择头像', + icon: 'none', + duration: 2000 + }); + return false; + } + + if (!this.data.ob.nickname) { + wx.showToast({ + title: '请输入昵称', + icon: 'none', + duration: 2000 + }); + return false; + } + + if (this.data.load) return false; + this.setData({load: 1}) + + wx.showLoading(); + + getApp().request.put("/api/weshop/users/update", { + data: { + store_id: os.stoid, + user_id: getApp().globalData.user_id, + nickname: this.data.ob.nickname, + head_pic: this.data.ob.head_pic + + }, + success: function (su) { + + setTimeout(()=>{ + wx.hideLoading(); + if (su.data.code == 0) { + wx.navigateBack({delta: 1}) + }else{ + that.setData({load: 0}) + wx.showToast({ + title: su.data.msg, + icon: 'none', + duration: 2000 + }); + } + },1000) + + + } + }); + },500) + + + }, + save_cell(){ + if (!this.data.ob.head_pic) { + wx.showToast({ + title: '请选择头像', + icon: 'none', + duration: 2000 + }); + return false; + } + if (!this.data.ob.nickname) { + wx.showToast({ + title: '请输入昵称', + icon: 'none', + duration: 2000 + }); + return false; + } + if (this.data.load) return false; + this.setData({load: 1}) + wx.setStorageSync('nick_obj', this.data.ob) + wx.navigateBack() + } + +}) \ No newline at end of file diff --git a/packageE/pages/user/nick_avatar_add/nick_avatar_add.json b/packageE/pages/user/nick_avatar_add/nick_avatar_add.json new file mode 100644 index 0000000..da6b1ad --- /dev/null +++ b/packageE/pages/user/nick_avatar_add/nick_avatar_add.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "修改头像昵称", + "usingComponents": {} +} \ No newline at end of file diff --git a/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxml b/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxml new file mode 100644 index 0000000..be8dc16 --- /dev/null +++ b/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxml @@ -0,0 +1,25 @@ + + + 头像 + + + + + 昵称 + + + + + + + + + + + 确认 + + + + \ No newline at end of file diff --git a/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxss b/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxss new file mode 100644 index 0000000..c8665ea --- /dev/null +++ b/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxss @@ -0,0 +1,30 @@ +.avatar_btn{ width: 60rpx !important; height: 60rpx !important; border-radius:50%; border: none !important; + margin-left:0 !important;margin-right: 0 !important; } +.head_img{ width: 60rpx; height: 60rpx; border-radius: 50%} + +.page_set{ border-top: 20rpx solid #eee; } +.item{ height: 80rpx; border-bottom: 1rpx solid #eee;padding:0 20rpx} +.nick_inp{ text-align: right; color: #999} + + +.confirm { + width: 100%; + left: 0rpx; + bottom: 0rpx; + height: 130rpx; + background-color: rgb(255, 255, 255); + z-index: 9; + +} + +.confirmtext { + width: 495rpx; + height: 65rpx; + color: rgb(255, 255, 255); + background-color: rgb(214, 1, 33); + border-radius: 35rpx; +} + +.load{ + background-color:#eee !important; +} \ No newline at end of file diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index 257f307..8bece44 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -18,7 +18,9 @@ Page({ iurl: os.imghost, ad_data: null, max_sw_height: 200, - is_retail_price:0 + is_retail_price:0, + isget:0, + msgStatus:false }, //------初始化加载---------- @@ -81,7 +83,7 @@ Page({ }, onShow: function (t) { - getApp().check_can_share(); + getApp().check_can_share(); this.data.is_timer = 1; this.data.currentPage = 1; this.data.ismore = 1; @@ -142,14 +144,14 @@ Page({ //读取数据 async requestSalelist() { if (!this.data.ismore) return false; - var e = this, - th = e, - i = "/api/weshop/teamlist/pageteam/" + th.data.type + "?page=" + e.data.currentPage; - var plist = [], - alllist = th.data.goodlist; + var e = this,th = e; + var i = "/api/weshop/teamlist/pageteam/" + th.data.type + "?page=" + e.data.currentPage; + var plist = [],alllist = th.data.goodlist; if (!alllist) alllist = []; + + wx.showLoading(); await getApp().request.promiseGet(i, { - isShowLoading: 1, + isShowLoading: 0, data: { store_id: os.stoid, is_end: 0, @@ -161,28 +163,82 @@ Page({ }); if (plist.length <= 0) { - getApp().showWarning("没有更多数据"); + + th.data.ismore = 0; - } - //--循环读取接口--- - for (var i = 0; i < plist.length; i++) { - var prom_id = plist[i].id; - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + - os.stoid + "/6/" + prom_id, {}).then(res => { - if (res.data.code == 0) { - plist[i].status = 1; - if (res.data.data <= 0) plist[i].status = 3; + //没有数据切换 + if (e.data.currentPage == 1 && this.data.type == 1) { + + e.data.currentPage=1; + i = "/api/weshop/teamlist/pageteam/0?page=" + e.data.currentPage; + await getApp().request.promiseGet(i, { + isShowLoading: 0, + data: { + store_id: os.stoid, + is_end: 0, + is_show: 1, + user_id:getApp().globalData.user_id, + } + }).then(res => { + if(ut.ajax_ok(res)){ + th.data.b_plist = res.data.data.pageData; + } + }); + + wx.hideLoading(); + if(th.data.b_plist){ + //组件的id + var auto_go = th.selectComponent("#auto_go"); + auto_go.show(); + + }else{ + getApp().showWarning("没有更多数据"); } - }); - alllist.push(plist[i]); + + // if(plist){ + // setTimeout(function () { + // th.data.ismore = 1; + // th.setData({ + // type: 0 + // }); + // th.requestSalelist(); + // }, 1000); + // } + + } + else{ + wx.hideLoading(); + getApp().showWarning("没有更多数据"); + } + + return false; } - e.data.currentPage++; + if(plist) { + //--循环读取接口--- + for (var i = 0; i < plist.length; i++) { + var prom_id = plist[i].id; + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/6/" + prom_id, {}).then(res => { + if (res.data.code == 0) { + plist[i].status = 1; + if (res.data.data <= 0) plist[i].status = 3; + } + }); + alllist.push(plist[i]); + } + e.data.currentPage++; + } th.setData({ goodlist: alllist, isshow: 1, - ismore:0, + is_get:1, }); + + setTimeout(()=>{ + wx.hideLoading(); + },500) + }, onPullDownRefresh: function () { @@ -205,6 +261,12 @@ Page({ type: a, goodlist: [] }); + + if(a==0){ + var auto_go = th.selectComponent("#auto_go"); + auto_go.stop(); + } + this.reloadGoodList(); }, @@ -276,7 +338,7 @@ Page({ } }, - onShareTimeline() { + onShareTimeline() { getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; if (!store_name) @@ -302,4 +364,44 @@ Page({ } }, + //-- 自动数数,要进行跳转 --- + async auto_back(){ + + var e=this,th=this; + th.setData({ type: 0 }); + wx.showLoading(); + + var plist=this.data.b_plist; + var alllist = th.data.goodlist; + if (!alllist) alllist = []; + + if(plist) { + //--循环读取接口--- + for (var i = 0; i < plist.length; i++) { + var prom_id = plist[i].id; + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/6/" + prom_id, {}).then(res => { + if (res.data.code == 0) { + plist[i].status = 1; + if (res.data.data <= 0) plist[i].status = 3; + } + }); + alllist.push(plist[i]); + } + e.data.currentPage++; + } + th.setData({ + goodlist: alllist, + isshow: 1, + is_get:1, + }); + + setTimeout(()=>{ + wx.hideLoading(); + },400) + + + } + + }); \ No newline at end of file diff --git a/pages/activity/pind_list/pind_list.json b/pages/activity/pind_list/pind_list.json index fe12943..8bcf364 100644 --- a/pages/activity/pind_list/pind_list.json +++ b/pages/activity/pind_list/pind_list.json @@ -1,6 +1,7 @@ { "navigationBarTitleText": "天天拼单", "usingComponents": { - "share_box": "/components/share_box/share_box" + "share_box": "/components/share_box/share_box", + "auto_go": "/components/auto_go/auto_go" } } \ No newline at end of file diff --git a/pages/activity/pind_list/pind_list.wxml b/pages/activity/pind_list/pind_list.wxml index 949c5d3..366bbaa 100644 --- a/pages/activity/pind_list/pind_list.wxml +++ b/pages/activity/pind_list/pind_list.wxml @@ -104,9 +104,10 @@ -没有相关内容 - +没有相关内容 + + \ No newline at end of file diff --git a/pages/activity/seckill_list/seckill_list.js b/pages/activity/seckill_list/seckill_list.js index fecefef..aae4ded 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -11,7 +11,7 @@ Page({ killtime: null, currentPage: 1, goodlist: null, - type: 1, + type: 1, //1是进行中 0是即将开始 timer: null, ismore: 1, //是否可以加载更多 isshow: 0, @@ -167,6 +167,7 @@ Page({ if (!alllist) alllist = []; var user_id = getApp().globalData.user_id; if (!user_id) user_id = user_id; + var req = { store_id: os.stoid, timetype: th.data.type, @@ -175,27 +176,51 @@ Page({ user_id: user_id }; + wx.showLoading(); + await getApp().request.promiseGet(i, { - isShowLoading: 1, + isShowLoading: 0, data: req }).then(res => { if (ut.ajax_ok(res)) plist = res.data.data.pageData; - }); if (!plist || plist.length <= 0) { - getApp().showWarning("没有更多数据"); + wx.hideLoading(); + th.data.ismore = 0; if (e.data.currentPage == 1 && this.data.type == 1) { - setTimeout(function () { - th.data.ismore = 1; - th.setData({ - type: 0 + + //-- 弄到即将开始 -- + req.timetype=0; + await getApp().request.promiseGet(i, { + isShowLoading: 0, + data: req + }).then(res => { + if (ut.ajax_ok(res)) th.data.b_plist = res.data.data.pageData; }); - th.requestSalelist(); - }, 1000); + + wx.hideLoading(); + if(th.data.b_plist){ + //组件的id + var auto_go = th.selectComponent("#auto_go"); + auto_go.show(); + }else{ + getApp().showWarning("没有更多数据"); + } + // setTimeout(function () { + // th.data.ismore = 1; + // th.setData({ + // type: 0 + // }); + // th.requestSalelist(); + // }, 1000); + }else{ + wx.hideLoading(); + getApp().showWarning("没有更多数据"); } + return false; } @@ -203,6 +228,14 @@ Page({ for (var i = 0; i < plist.length; i++) { if (plist[i].user_price) plist[i].price = plist[i].user_price; + let price=plist[i].price+'' + if (price && price.indexOf('.')>-1) { + let priceArr = price.split(".") + plist[i].price_n = priceArr[0] + plist[i].price_xs = priceArr[1] + }else{ + plist[i].price_n = price + } var prom_id = plist[i].id; await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {} @@ -221,6 +254,10 @@ Page({ isshow: 1 }); + setTimeout(()=>{ + wx.hideLoading(); + },500) + }, @@ -244,6 +281,12 @@ Page({ type: a, goodlist: null }); + + if(a==0){ + var auto_go = th.selectComponent("#auto_go"); + auto_go.stop(); + } + this.reloadGoodList(); }, @@ -336,4 +379,50 @@ Page({ getApp().goto(url); } }, + + async auto_back(){ + + var e=this,th=this; + th.setData({ type: 0 }); + wx.showLoading(); + + var plist=this.data.b_plist; + var alllist = th.data.goodlist; + if (!alllist) alllist = []; + + //--循环读取接口--- + for (var i = 0; i < plist.length; i++) { + + if (plist[i].user_price) plist[i].price = plist[i].user_price; + let price=plist[i].price+'' + if (price && price.indexOf('.')>-1) { + let priceArr = price.split(".") + plist[i].price_n = priceArr[0] + plist[i].price_xs = priceArr[1] + }else{ + plist[i].price_n = price + } + var prom_id = plist[i].id; + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/1/" + prom_id, {} + ).then(res => { + if (res.data.code == 0) { + plist[i].status = 1; + if (res.data.data <= 0) plist[i].status = 3; + } + }) + alllist.push(plist[i]); + } + e.data.currentPage++; + console.log("秒杀商品列表", alllist); + th.setData({ + goodlist: alllist, + isshow: 1 + }); + + setTimeout(()=>{ + wx.hideLoading(); + },400) + } + }); \ No newline at end of file diff --git a/pages/activity/seckill_list/seckill_list.json b/pages/activity/seckill_list/seckill_list.json index e533db3..2ef2396 100644 --- a/pages/activity/seckill_list/seckill_list.json +++ b/pages/activity/seckill_list/seckill_list.json @@ -1,6 +1,7 @@ { "navigationBarTitleText": "商品秒杀", "usingComponents": { - "share_box": "/components/share_box/share_box" + "share_box": "/components/share_box/share_box", + "auto_go": "/components/auto_go/auto_go" } } \ No newline at end of file diff --git a/pages/activity/seckill_list/seckill_list.wxml b/pages/activity/seckill_list/seckill_list.wxml index 588ad3c..4a156b0 100644 --- a/pages/activity/seckill_list/seckill_list.wxml +++ b/pages/activity/seckill_list/seckill_list.wxml @@ -46,7 +46,7 @@ - + 剩余{{type==1?filters.toFix(100-(item.buy_num+item.virtual)/(item.goods_num+item.virtual)*100,0):'100'}}% @@ -68,7 +68,8 @@ - {{item.price}} + {{item.price_n}} + .{{item.price_xs}} 零售价¥{{item.market_price}} @@ -99,8 +100,10 @@ - 没有相关内容 + + + diff --git a/pages/activity/seckill_list/seckill_list.wxss b/pages/activity/seckill_list/seckill_list.wxss index 6cc6698..9d3b2fb 100644 --- a/pages/activity/seckill_list/seckill_list.wxss +++ b/pages/activity/seckill_list/seckill_list.wxss @@ -110,7 +110,8 @@ padding-top: 4rpx; .kill-btn>navigator { padding: 0 20rpx; - background: #e23245; + /* background: #e23245; */ + background: #f23030; color: #fff; border-radius: 20rpx; margin-top: 37px; diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index dc1ecae..0ca4195 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -1559,9 +1559,9 @@ Page({ valueToNum: function (t) { if (!this.data.is_load) return false; //控制住,避免事件响应冲突,只有input有输入的时候,才刷新 - if (this.data.btn_click) { - return false; - } + // if (this.data.btn_click) { + // return false; + // } this.data.btn_click = 1; var a = t.currentTarget.dataset.item; @@ -1582,7 +1582,7 @@ Page({ }, //-------------加数量--------------------- - addNum: function (t) { + addNum:async function (t) { if (!this.data.is_load) return false; if (this.data.up_dating == 1) return false; this.data.up_dating = 1; @@ -1594,7 +1594,6 @@ Page({ console.log('add+'); if (this.data.sales_rules < 2 || a.whsle_id || [1, 2, 4, 6, 8, 9].indexOf(a.prom_type) > -1) { - if (a.goods_num > a.store_count) { console.log('购买的数量不能-----'); // wx.showModal({ @@ -1612,19 +1611,28 @@ Page({ } } + var add_num=1; + //调用接口判断是不是促销活动的商品 + if([0,3,5,7,10].indexOf(a.prom_type) > -1){ + var cx_arr=await getApp().get_has_cx_act(a.goods_id); + var steep=getApp().get_limit_qty(a,cx_arr.length,1); + if(steep>1){ + add_num=steep; + } + } var e = { - goods_num: a.goods_num + 1, + goods_num: a.goods_num + add_num, id: a.id, goods_id: a.goods_id, store_id: oo.stoid }; // console.log('goods_num', e.goods_num); - this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); + this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems,cx_arr); }, //-------------减数量--------------------- - subNum: function (t) { + subNum: async function (t) { if (!this.data.is_load) return false; if (this.data.up_dating == 1) return false; this.data.up_dating = 1; @@ -1640,16 +1648,28 @@ Page({ } + var add_num=1; + if([0,3,5,7,10].indexOf(a.prom_type) > -1){ + var cx_arr=await getApp().get_has_cx_act(a.goods_id); + var steep = getApp().get_limit_qty(a, cx_arr.length, 1); + if (steep > 1) { + add_num = steep; + } + } - if (1 != a.goods_num) { - var e = { - goods_num: a.goods_num - 1, - id: a.id, - goods_id: a.goods_id, - store_id: oo.stoid - }; - this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); + var e = { + goods_num: a.goods_num - add_num, + id: a.id, + goods_id: a.goods_id, + store_id: oo.stoid + }; + + if(e.goods_num<=0){ + this.data.up_dating = 0; + return false; } + this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); + }, @@ -1754,6 +1774,33 @@ Page({ }, + click_set_limit(gd_info,pitems,item,act){ + var th=this; + var mo_num=getApp().get_limit_qty(gd_info,act.length); + var steep=getApp().get_limit_qty(gd_info,act.length,1); + if(gd_info.is_integral_normal || gd_info.is_pd_normal || [0,3,5,7,10].indexOf(gd_info.prom_type) > -1){ + + var ue = { + goods_num: gd_info.goods_num,store_id: oo.stoid, + id: gd_info.id,goods_id: gd_info.goods_id + }; + var up_num=0; + if(mo_num>gd_info.goods_num){ + up_num=mo_num; + } + if(gd_info.goods_num>mo_num && (gd_info.goods_num-mo_num)%steep!=0 && steep>1){ + up_num=mo_num+ parseInt((gd_info.goods_num-mo_num)/steep)*steep+steep; + } + if(up_num){ + ue.goods_num=up_num; + th.update_cart(ue, pitems, item); + var txt1 = "requestData[" + pitems + "].goods[" + item + "].goods_num"; + th.setData({[txt1]:up_num }) + } + } + }, + + //---------------全选,全选的时候要判断是否门店的匹配方式一致-------------- checkAll: async function () { var e = this, @@ -1792,11 +1839,19 @@ Page({ [txt]: 0, }); } + var fir = 0; for (var j = 0; j < item.length; j++) { if (item[j].is_gift) continue; - var obj = JSON.parse(JSON.stringify(item[j])); + + //-- 判断起购数量 -- + if(!e.data.checkAllToggle){ + //判断是不是有促销活动 + var act=await getApp().get_has_cx_act(obj.goods_id); + th.click_set_limit(obj,i,j,act); + } + //计算之前先移除组合购的计算 if (obj.prom_type == 7) zh_calc.remove_zhprom(dda, i, obj); @@ -1884,7 +1939,7 @@ Page({ // if (!e.data.checkAllToggle) { //多门店优惠促销次数控制 - if(dda[i].pro_off){ + if(dda[i].pro_off || e.data.checkAllToggle){ var txt = "requestData[" + i + "].selected"; e.setData({ [txt]: 0, @@ -2037,13 +2092,17 @@ Page({ } let pro_off=false - for (var i = 0; i < item.length; i++) { let pro_off1=false var txt = "requestData[" + pitems + "].goods[" + i + "].selected"; - var gd_info = item[i]; - if (th.data.sales_rules >= 2 && !gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 && !gd_info.selected) { + + if(!sele) { + var act=await getApp().get_has_cx_act(gd_info.goods_id); + th.click_set_limit(gd_info,pitems,i,act) + } + + if(!gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 && !gd_info.selected && th.data.sales_rules >= 2 ) { var ob = {}; await th.check_down_line_next(gd_info, pitems, i, gd_info.erpwareid, function (res) { ob = res; @@ -2227,45 +2286,56 @@ Page({ var gd_info = a; var erpwareid = gd_info.erpwareid; - if (th.data.sales_rules >= 2 && !gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 && !a.selected) { - var ob = {}; - await th.check_down_line_next(gd_info, pitems, item, erpwareid, function (res) { - ob = res; - }); - - if (ob.code == -1) { - - wx.showToast({ - title: '购买数量超出商品库存', - icon: 'none', - }); - return false; - } else { - if (th.data.sales_rules == 3) { - var goods_id = gd_info.goods_id; - var num = 0; + //-- 如果是选中的时候 -- + if(!a.selected){ + //判断是不是有促销活动 + var act=await getApp().get_has_cx_act(gd_info.goods_id); + //-- 专门来设置商品订购数量 -- + th.click_set_limit(gd_info,pitems,item,act) + if (th.data.sales_rules >= 2 && !gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 ) { - for (let i = 0; i < th.data.requestData.length; i++) { - if (pitems == i) continue; - var it = th.data.requestData[i].goods.find((e) => { - return e.goods_id == goods_id; - }) - if (it && it.selected) num += it.goods_num - } + var ob = {}; + await th.check_down_line_next(gd_info, pitems, item, erpwareid, function (res) { + ob = res; + }); + if (ob.code == -1) { - if (num > ob.CanOutQty) { wx.showToast({ title: '购买数量超出商品库存', icon: 'none', }); return false; + } else { + if (th.data.sales_rules == 3) { + var goods_id = gd_info.goods_id; + var num = 0; + + for (let i = 0; i < th.data.requestData.length; i++) { + if (pitems == i) continue; + var it = th.data.requestData[i].goods.find((e) => { + return e.goods_id == goods_id; + }) + if (it && it.selected) num += it.goods_num + } + + if (num > ob.CanOutQty) { + wx.showToast({ + title: '购买数量超出商品库存', + icon: 'none', + }); + + return false; + } + } } - } + } } + + let pro_off=false //判断多店优惠促销次数控制 if (th.data.requestData.length>1) { @@ -2529,34 +2599,56 @@ Page({ }); }, - //----------------------更新购物数量,加减,调用接口--------------------- - postCardList: function (t, item, pitem) { - var e = this, - th = e, - user_id = getApp().globalData.user_id; - - function normal_check(store_count, goodsinfo, wareIds) { - //--- 看一下是不是线下库存 --- - if (th.data.sales_rules >= 2 && !goodsinfo.whsle_id) { - th.check_down_line(t, pitem, item, wareIds); - } else { - if (t.goods_num > store_count) { - wx.showToast({ - title: '购买数量超出商品库存', - icon: 'none', - }); - // getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: store_count - }); - e.doCheckAll(); - t.goods_num = store_count; + //-- 循环汇总其他门店,其他活动有此商品的购买数量的汇总,不包含赠品 -- + get_goods_other(item, pitem,only){ + var goods_id = this.data.requestData[pitem].goods[item].goods_id; + var prom_type = this.data.requestData[pitem].goods[item].prom_type; + var prom_id = this.data.requestData[pitem].goods[item].prom_id; + + var num=0; + //-- 相同活动的商品汇总,秒杀,团购 -- + if(only==2){ + for (let j = 0; j < this.data.requestData.length;j++){ + if(j!=pitem){ + var goods=this.data.requestData[j].goods; + for (let k = 0; k by ty // var buyed_mum2 = t.goods_num + goodsbuynum; var buyed_mum2 = t.goods_num; //<-- + // 判断当前预购买的数量是否超过可购买的数量,限购还要考虑到商品的库存 + if (limit > 0) { - // 判断当前预购买的数量是否超过可购买的数量 - if (buyed_mum2 > (limit - goodsbuynum) && limit > 0) { - wx.showToast({ - title: '购买数量超出商品限购', - icon: 'none', - }); //getApp().my_warnning('购买数量超出商品限购', 0, th); var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + limit = limit - goodsbuynum; + if(limit<0) limit=0; + + if(buyed_mum2>limit){ + wx.showToast({ + title: '购买数量超出商品限购', + icon: 'none', + }); + is_showing=1; + } - //--> by ty - var cbuy = limit - goodsbuynum; - // var cbuy = limit - buyed_mum2 + 1; - //<-- - - e.setData({ - // [txt]: cbuy > 0 ? cbuy : 0, - [txt]: cbuy > 0 ? cbuy : limit, - }); - e.doCheckAll(); - - t.goods_num = cbuy > 0 ? cbuy : limit, - // t.goods_num = cbuy > 0 ? cbuy : 0, - e.update_cart(t, pitem, item); - return false; + // e.setData({ + // // [txt]: cbuy > 0 ? cbuy : 0, + // [txt]: cbuy > 0 ? cbuy : limit, + // }); + //e.doCheckAll(); + // t.goods_num = cbuy > 0 ? cbuy : limit; + // + // if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){ + // + // //-- 判断商品是不是 -- + // var cx_arr=await getApp().get_has_cx_act(goodsinfo.goods_id); + // var mo_num=getApp().get_limit_qty(goodsinfo,cx_arr.length); + // var steep=getApp().get_limit_qty(goodsinfo,cx_arr.length,1); + // + // if(mo_num>1 && t.goods_num1 && t.goods_num>mo_num && (t.goods_num-mo_num)%steep!=0 ){ + // + // wx.showToast({ + // title: '购买数量必须是起订量的倍数', + // icon: 'none', + // }); + // + // t.goods_num=mo_num+parseInt((t.goods_num-mo_num)/steep+'')*steep + // } + // } + // // t.goods_num = cbuy > 0 ? cbuy : 0, + // e.update_cart(t, pitem, item); + // return false; } - + else limit=100000; switch (goodsinfo.prom_type) { case 1: - //读取秒杀 - rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, { - isShowLoading: 0, - success: function (res_d) { - if (res_d.data.code == 0 && res_d.data.data) { - if (t.goods_num > store_count) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出商品库存' - // }); + //-- 读取秒杀 -- + var res_d= await getApp().promiseGet("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, {}); + if (res_d.data.code == 0 && res_d.data.data) { + + var cbuy=limit; + if (t.goods_num> store_count && !is_showing) { wx.showToast({ title: '购买数量超出商品库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: store_count - }); - e.doCheckAll(); - - t.goods_num = store_count; - e.update_cart(t, pitem, item); - - return false; + is_showing=1; } + //一直都要给一个最小值,和库存比较 + if(cbuy>store_count) cbuy=store_count; var false_data = res_d.data.data; //--判断库存-- - if (t.goods_num > false_data.goods_num - false_data.buy_num) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出活动库存' - // }); + if (t.goods_num > false_data.goods_num - false_data.buy_num && !is_showing) { wx.showToast({ title: '购买数量超出活动库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出活动库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: false_data.goods_num - false_data.buy_num - }); - e.doCheckAll(); - - t.goods_num = false_data.goods_num - false_data.buy_num; - e.update_cart(t, pitem, item); - - return false; + is_showing=1; } + //一直都要给一个最小值,和活动库存比较 + if(cbuy>false_data.goods_num - false_data.buy_num) + cbuy=false_data.goods_num - false_data.buy_num; + //--判断redis数量是否已经超出-- - if (t.goods_num > false_data.redisnum) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出商品库存' - // }); + if (t.goods_num > false_data.redisnum && !is_showing) { wx.showToast({ title: '购买数量超出商品库存', icon: 'none', }); - //getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: false_data.redisnum - }); - e.doCheckAll(); - - t.goods_num = false_data.redisnum; - e.update_cart(t, pitem, item); - return false; + is_showing=1; } + //一直都要给一个最小值,和活动库存比较 + if(cbuy>false_data.redisnum) cbuy=false_data.redisnum; + //--活动的限购是不是要判断-- - if (t.goods_num + promgoodsbuynum > false_data.buy_limit && false_data.buy_limit > 0) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出秒杀限购' - // }); - wx.showToast({ - title: '购买数量超出秒杀限购', - icon: 'none', - }); - // getApp().my_warnning('购买数量超出秒杀限购', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: false_data.buy_limit - }); - e.doCheckAll(); - t.goods_num = (false_data.buy_limit - promgoodsbuynum) ? false_data.buy_limit - promgoodsbuynum : 0; - e.update_cart(t, pitem, item); - return false; + if(false_data.buy_limit > 0) { + if(t.goods_num + promgoodsbuynum > false_data.buy_limit && !is_showing){ + wx.showToast({ + title: '购买数量超出秒杀限购', + icon: 'none', + }); + } + var act_limit=false_data.buy_limit-promgoodsbuynum; + if(!act_limit) act_limit=0; + if(cbuy>act_limit) cbuy=act_limit; + } + + if(t.goods_num>cbuy) t.goods_num=cbuy; + e.update_cart(t, pitem, item); - } else { - normal_check(store_count, goodsinfo, wareIds); - } - } - }) - break; + } else { + e.normal_check(t, item, pitem,store_count,limit,goodsinfo, wareIds); //普通商品的调用和计算 + } + break; case 2: - getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, {}).then(res => { + + //-- 读取团购 -- + var res= await getApp().promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, {}); if (res.data.code == 0 && res.data.data) { - if (t.goods_num > store_count) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出商品库存' - // }); + + var cbuy=limit; + if (t.goods_num > store_count && !is_showing) { wx.showToast({ title: '购买数量超出商品库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: store_count - }); - e.doCheckAll(); - - t.goods_num = store_count; - e.update_cart(t, pitem, item); - - return false; + is_showing=1; } + //一直都要给一个最小值,和库存比较 + if(cbuy>store_count) cbuy=store_count; var gr_data = res.data.data; //--判断库存-- - if (t.goods_num > gr_data.goods_num - gr_data.buy_num) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出活动库存' - // }); + if (t.goods_num > gr_data.goods_num - gr_data.buy_num && !is_showing) { wx.showToast({ title: '购买数量超出活动库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出活动库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: gr_data.goods_num - gr_data.buy_num - }); - e.doCheckAll(); - - t.goods_num = gr_data.goods_num - gr_data.buy_num; - e.update_cart(t, pitem, item); - - return false; + is_showing=1; } + //一直都要给一个最小值,和库存比较 + if(cbuy>gr_data.goods_num - gr_data.buy_num ) cbuy=gr_data.goods_num - gr_data.buy_num; //--判断redis数量是否已经超出-- - if (t.goods_num > gr_data.redisnum) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出商品库存' - // }); + if (t.goods_num > gr_data.redisnum && !is_showing) { wx.showToast({ title: '购买数量超出商品库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: gr_data.redisnum - }); - e.doCheckAll(); - - t.goods_num = gr_data.redisnum; - e.update_cart(t, pitem, item); - return false; + is_showing=1; } + if(cbuy>gr_data.redisnum) cbuy=gr_data.redisnum; //--活动的限购是不是要判断-- - if (t.goods_num + promgoodsbuynum > gr_data.buy_limit && gr_data.buy_limit > 0) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出团购限购' - // }); - wx.showToast({ - title: '购买数量超出团购限购', - icon: 'none', - }); - // getApp().my_warnning('购买数量超出团购限购', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: gr_data.buy_limit - }); - e.doCheckAll(); + if (gr_data.buy_limit > 0) { + if(t.goods_num + promgoodsbuynum > gr_data.buy_limit && !is_showing){ + wx.showToast({ + title: '购买数量超出团购限购', + icon: 'none', + }); + is_showing=1; + } - t.goods_num = (gr_data.buy_limit - promgoodsbuynum) ? gr_data.buy_limit - promgoodsbuynum : 0; - e.update_cart(t, pitem, item); - return false; + var act_limit=gr_data.buy_limit-promgoodsbuynum; + if(!act_limit) act_limit=0; + + if(cbuy>act_limit) cbuy=act_limit; } + + if(t.goods_num>cbuy) t.goods_num=cbuy; + e.update_cart(t, pitem, item); } else { - normal_check(store_count, goodsinfo, wareIds); + e.normal_check(t, item, pitem,store_count,limit,goodsinfo, wareIds); //普通商品的调用和计算 } - }) - - break; + break; default: - normal_check(store_count, goodsinfo, wareIds); + e.normal_check(t, item, pitem,store_count,limit,goodsinfo, wareIds); //普通商品的调用和计算 break } } }); }, + //-- 这个函数在计算的时候,要包含限购的那一部分 -- + async normal_check(t, item, pitem,store_count,limit,goodsinfo, wareIds){ + + var cx_arr=await getApp().get_has_cx_act(goodsinfo.goods_id); + + var th=this; + // getApp().my_warnning('购买数量超出商品库存', 0, th); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + + + var cQty=store_count; + //--- 看一下是不是线下库存 --- + if (th.data.sales_rules >= 2 && !goodsinfo.whsle_id) { + //th.check_down_line(t, pitem, item, wareIds,limit); + var ob = {}; + await th.check_down_line_next(t, pitem, item, wareIds, function (res) { + ob = res; + }); + cQty=ob.CanOutQty; + } + + var is_showing=0; + var cbuy=limit; + if (t.goods_num > limit) { + wx.showToast({ + title: '购买数量超出商品限购', + icon: 'none', + }); + is_showing=1; + } + + if (t.goods_num > cQty) { + if(!is_showing){ + wx.showToast({ + title: '购买数量超出商品库存', + icon: 'none', + }); + is_showing=1; + } + } + if(cbuy>cQty) cbuy=cQty; + + if(t.goods_num>cbuy) t.goods_num=cbuy; + + if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){ + var mo_num=getApp().get_limit_qty(goodsinfo,cx_arr.length); + var steep=getApp().get_limit_qty(goodsinfo,cx_arr.length,1); + + if(mo_num>1 && t.goods_num1 && t.goods_num>mo_num && (t.goods_num-mo_num)%steep!=0){ + if(!is_showing) { + wx.showToast({ + title: '购买数量必须是起订量的倍数', + icon: 'none', + }); + } + if(t.goods_num= 2 && this_obj.selected) { var goods_id = this_obj.goods_id; - var num = 0; for (let i = 0; i < this.data.requestData.length; i++) { @@ -3136,21 +3245,28 @@ Page({ return false; } - - } } - - this.update_cart(t, pitem, item); }, + + //---检验线下库存的数量的子函数--- async check_down_line_next(t, pitem, item, erpwareid, func) { var goodsinfo = this.data.requestData[pitem].goods[item]; + if(getApp().is_virtual(goodsinfo)){ + var ob = {}; + ob.code = 1; + ob.CanOutQty = 100000; + func(ob); + return false; + } + + var lock = 0, pick_no, plist; @@ -3278,7 +3394,6 @@ Page({ //--------------去结算------------ async checkout() { - if (getApp().is_sp_hao()) { wx.showToast({ title: "视频号不支持购物车购买", @@ -3370,9 +3485,42 @@ Page({ } glist += i_arr[j].goods_id + ","; ab = 1; - + + //-- 获取促销活动是不是有参与 -- + var act=await getApp().get_has_cx_act(i_arr[j].goods_id); + //-- 判断商品的起订数量 -- + var mo_num=getApp().get_limit_qty(i_arr[j],act.length); + var steep=getApp().get_limit_qty(i_arr[j],act.length,1); + var py_type= parseInt(i_arr[j].prom_type+''); + + if([0,3,5,7,10].indexOf(py_type)>-1){ + + if(mo_num>i_arr[j].goods_num){ + getApp().confirmBox(i_arr[j].goods_name + "的未达到起订数量"); + wx.hideLoading(); + return false; + } + if(steep>1 && (i_arr[j].goods_num-mo_num)%steep!=0 ){ + getApp().confirmBox(i_arr[j].goods_name + "的购买的数量不是起订量的倍数"); + var num=mo_num+ parseInt((i_arr[j].goods_num-mo_num)/steep)*steep+steep; + var e = { + goods_num: num, + id: i_arr[j].id, + goods_id: i_arr[j].goods_id, + store_id: oo.stoid + }; + + th.postCardList(e, j, i); + + wx.hideLoading(); + return false; + } + + } + + //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- - if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || i_arr[j].prom_type == 7 || + if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || i_arr[j].prom_type == 7 || i_arr[j].prom_type == 10 || i_arr[j].need_downlow_num) && th.data.sales_rules >= 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) { //--获取商品的线下商品ID-- @@ -3480,9 +3628,6 @@ Page({ return false } - - - if (checkArr7.length > 0) { let checkStr = [] checkArr7.map(item => { diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index 60e8fab..5d07948 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -42,6 +42,7 @@ + @@ -138,6 +139,7 @@ 送赠品| 送礼包| 送专享礼包| + 送每月礼包| 去凑单> diff --git a/pages/cart/cart2_inte/cart2_inte.json b/pages/cart/cart2_inte/cart2_inte.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/cart/cart2_inte/cart2_inte.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/cart/cart2_inte/cart2_inte.wxss b/pages/cart/cart2_inte/cart2_inte.wxss new file mode 100644 index 0000000..08a765a --- /dev/null +++ b/pages/cart/cart2_inte/cart2_inte.wxss @@ -0,0 +1 @@ +/* pages/cart/cart2_inte/cart2_inte.wxss */ \ No newline at end of file diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxss b/pages/giftpack/giftpacklist/giftpacklist.wxss index 2e26421..68ce4b7 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.wxss +++ b/pages/giftpack/giftpacklist/giftpacklist.wxss @@ -92,7 +92,8 @@ .box_ware_img image.data-v-3a5b7e36 { /* width: 185rpx; height: 190rpx; *//* background-color: rgba(138, 138, 138, 0.63); */ - border: 2rpx solid #999; + border: 2rpx solid #fafaf9; + border-radius: 4rpx; width: 120rpx; height: 120rpx; background-color: #f8f8f8; diff --git a/pages/goods/goodsInfo/buy_com_pop.wxml b/pages/goods/goodsInfo/buy_com_pop.wxml index d81e608..9dd9a1c 100644 --- a/pages/goods/goodsInfo/buy_com_pop.wxml +++ b/pages/goods/goodsInfo/buy_com_pop.wxml @@ -13,10 +13,14 @@ 已售:{{sele_g.sales_sum}} - - 可售:{{def_pick_store.CanOutQty}} - - 可售:0 + + + + 可售:{{def_pick_store.CanOutQty}} + + 可售:0 + + 可售:{{sele_g.store_count}} @@ -29,8 +33,8 @@ - - {{def_pick_store.pickup_name}} + + {{def_pick_store.pickup_name}} 距离:{{def_pick_store.distance > 1000 ? filters.toFix(def_pick_store.distance / 1000, 2) + "km" : filters.toFix(def_pick_store.distance, 0) + "m"}} @@ -53,7 +57,7 @@ (库存不足) (配送不匹配) - + (库存不足) @@ -136,8 +140,8 @@ - - + 库存不足 @@ -152,9 +156,7 @@ - - - + 库存不足 diff --git a/pages/goods/goodsInfo/buy_integral.wxml b/pages/goods/goodsInfo/buy_integral.wxml index fc198a4..4e47ae6 100644 --- a/pages/goods/goodsInfo/buy_integral.wxml +++ b/pages/goods/goodsInfo/buy_integral.wxml @@ -26,9 +26,9 @@ - - {{def_pick_store.pickup_name}} - + + {{def_pick_store.pickup_name}} + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} @@ -47,11 +47,13 @@ (库存不足) (配送不匹配) - (库存不足) + + (库存不足) + - 地址:{{def_pick_store.fulladdress}} + 地址:{{def_pick_store.fulladdress}} diff --git a/pages/goods/goodsInfo/buy_pt.wxml b/pages/goods/goodsInfo/buy_pt.wxml index 62530c5..896489e 100644 --- a/pages/goods/goodsInfo/buy_pt.wxml +++ b/pages/goods/goodsInfo/buy_pt.wxml @@ -25,8 +25,10 @@ 已售:{{sele_g.sales_sum}} - 可售:{{def_pick_store.CanOutQty}} - 可售:0 + + 可售:{{def_pick_store.CanOutQty}} + 可售:0 + 可售:{{sele_g.store_count}} @@ -47,11 +49,11 @@ - - {{def_pick_store.pickup_name}} + + {{def_pick_store.pickup_name}} - + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} @@ -71,7 +73,7 @@ (库存不足) (配送不匹配) - (库存不足) + (库存不足) @@ -176,16 +178,32 @@ 请先选择门店 - - - - 库存不足 - - - 立即购买 - - - + + + + + + + + 库存不足 + + + + 立即购买 + + + + + + + 库存不足 + + + + 立即购买 + + + diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index cd996f1..e7baa66 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -481,7 +481,7 @@ Page({ appoint_pick_keyid: json_d.appoint_pick_keyid }); - + //------几人评价------- //n.init(th, "", "comments"); @@ -1102,18 +1102,12 @@ Page({ }); + + //获取统一条形码,普通商品和优惠促销的商品 if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7 || ee.data.data.prom_type == 9 || ee.data.data.prom_type == 10) { - //默认门店要拿下门店库存 - if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { - //获取门店 - ee.get_sto(); - - } else { - //获取门店 - ee.get_sto(); - } + ee.get_sto(); ee.get_sku(o.stoid, t.data.data, gid); ee.check_has_flash(); @@ -1197,6 +1191,7 @@ Page({ setTimeout(()=> { console.log('cccc'); console.log(th.data.prom_type); + },500) @@ -1208,11 +1203,8 @@ Page({ console.log('aaaaaaaaaa'); console.log(this.data.prom_type); - this.data.enterAddressPage && (this.data.enterAddressPage = !1); - - - + this.data.enterAddressPage && (this.data.enterAddressPage = !1); }, @@ -1778,7 +1770,7 @@ Page({ return false; } else { //---如果是线下门店销售的时候--- - if (th.data.sales_rules >= 2) { + if (!th.data.sele_g.whsle_id && th.data.sales_rules >= 2) { var pick = th.get_pick_from_list(th.data.sto_sele_id) th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { @@ -1942,6 +1934,9 @@ Page({ th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 } } + + + }) }, @@ -2402,11 +2397,30 @@ Page({ //----------增加购买数量----------- addCartNum: function (t) { - this.checkCartNum(this.data.goodsInputNum + 1); + var add_num=1; + var p_type=parseInt(this.data.prom_type) + if([1,2,4,6,8,9].indexOf(p_type)==-1 || this.data.openSpecModal_inte_normal == 1 || this.data.is_normal == 1){ + add_num = getApp().get_limit_qty(this.data.sele_g, this.data.is_act, 1); + } + + this.checkCartNum(this.data.goodsInputNum + add_num); }, //----------减少购买数量----------- subCartNum: function (t) { - this.checkCartNum(this.data.goodsInputNum - 1); + var add_num=1; + var p_type=parseInt(this.data.prom_type) + if([1,2,4,6,8,9].indexOf(p_type)==-1 || this.data.openSpecModal_inte_normal == 1 || this.data.is_normal == 1){ + add_num = getApp().get_limit_qty(this.data.sele_g, this.data.is_act, 1); + var mo_num = getApp().get_limit_qty(this.data.sele_g, this.data.is_act); + if(this.data.goodsInputNum - add_num 0) { @@ -2442,13 +2462,16 @@ Page({ title: '超出商品限购', icon: 'none', }); + + is_show_bs=1; + // s.my_warnning('超出商品限购', 0, th); - var num = th.data.sele_g.viplimited - gd_buy_num; - if (num < 0) num = 0; - th.setData({ - goodsInputNum: num - }) - return false; + l_num = th.data.sele_g.viplimited - gd_buy_num; + if (l_num < 0) l_num = 0; + // th.setData({ + // goodsInputNum: num + // }) + // return false; } } @@ -2495,34 +2518,94 @@ Page({ } } var e = th.data.sele_g.store_count; - var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 - if (th.data.sales_rules >= 2 && (p_type != 1 && p_type != 4 && p_type != 6 && p_type != 2 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { - if (!th.data.def_pick_store) { - wx.showToast({ - title: '请选择门店', - icon: 'none', - }); - // wx.showModal({title: '请选择门店',}); - return false; - } else { - e = th.data.def_pick_store.CanOutQty; + var p_type =parseInt(th.data.prom_type+'') ; //&& p_type!=1 && p_type!=4 + if (!th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && + ([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { + + //-- 如果是虚拟商品,默认给最大值 -- + if(getApp().is_virtual(th.data.sele_g)){ + e = 100000; + }else{ + if (!th.data.def_pick_store) { + wx.showToast({ + title: '请选择门店', + icon: 'none', + }); + // wx.showModal({title: '请选择门店',}); + return false; + } else { + e = th.data.def_pick_store.CanOutQty; + } } } + + //-- 限购数量也要进行计算一下 -- + if(l_num>-1){ + if(e>l_num) e=l_num; + } + + //--- 促销活动也不控制起订量, 这里很重要的一个控制,起订量的 ---- + if([0,3,5,7,10].indexOf(p_type)>-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1){ + if(tmo_num && (t-mo_num)%steep!=0){ + + if(!is_show_bs){ + wx.showToast({ + title: '购买数必须是起订量的倍数', + icon: 'none', + }); + } + + t=mo_num+ parseInt((t-mo_num)/steep)*steep+steep; + is_show_bs=1; + } + } + if (!e) e = 0; //库存不足,不增加 if (e < t) { - wx.showToast({ - title: '库存不足', - icon: 'none', - }); + if(!is_show_bs){ + wx.showToast({ + title: '库存不足', + icon: 'none', + }); + } + // wx.showModal({title: '库存不足',}); if (e < 0) e = 0; + + //只有普通商品才有起购数 + if([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1){ + if(emo_num && (e-mo_num)%steep!=0){ + e=mo_num+ parseInt((e-mo_num)/steep)*steep; + } + } th.setData({ goodsInputNum: e }); return false; } + + //var steep=getApp().get_limit_qty(th.data.sele_g,0,1); t > e || 0 == e ? t = e : t < 1 && (t = 1); + + + //只有普通商品才有起购数 + if([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1){ + if(t= 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { - if (!th.data.def_pick_store) { - wx.showModal({ - title: '请选择门店', - }); - return false; - } else { - e = th.data.def_pick_store.CanOutQty; - } + if (!th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && + ([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { + + if(getApp().is_virtual(th.data.sele_g)){ + e=100000; + }else{ + if (!th.data.def_pick_store) { + wx.showModal({ + title: '请选择门店', + }); + return false; + } else { + e = th.data.def_pick_store.CanOutQty; + } + } + } if (!e) e = 0; //库存不足,不增加 @@ -3282,6 +3372,7 @@ Page({ //-----------选择属性的按钮事件---------- sele_spec: function (e) { var that = this; + var th=this; var gid = e.currentTarget.dataset.gid; var nor = e.currentTarget.dataset.nor; var user_id=getApp().globalData.user_id; @@ -3306,6 +3397,18 @@ Page({ }) } + //拼团在点击回来的时候,还是只能是立即购买,不能有购物车的情况 + if(this.data.base_nor_prom_type==6 && parseInt(gid+'')==parseInt(this.data.base_nor_goods_id+'')){ + this.setData({ + openSpecModal_pt:1, + openSpecModal:0, + sku_g:this.data.sku_g_pt, + is_normal:1 + }) + nor=1; + } + + //that.data.change=1; var item = null; for (var i in sku_g) { @@ -3336,10 +3439,12 @@ Page({ }); + if (nor) that.get_sto(1); else that.get_sto(); - if (!item.whsle_id && [1,2,4,6].indexOf(item.prom_type)==-1) that.check_is_youhui(gid, that.data.is_normal); + if (!item.whsle_id && ([1,2,4,6].indexOf(item.prom_type)==-1 || this.data.is_normal==1)) + that.check_is_youhui(gid, that.data.is_normal,1); //默认门店要拿下门店库存 if (that.data.sales_rules >= 2 && that.data.def_pick_store && !that.data.sele_g.whsle_id && [1,2,4,6].indexOf(item.prom_type)==-1) { @@ -3610,11 +3715,19 @@ Page({ let item = e.data.data.pageData[i]; if (item.category_id > 0) { his_cate_num = 1; - break; + } + if (getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2){ + e.data.data.pageData[i].CanOutQty=100000; } } + e.his_cate_num = his_cate_num; + if(th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}' + && getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2){ + th.setData({'def_pick_store.CanOutQty':100000}) + } + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) { th.setData({ @@ -3641,9 +3754,9 @@ Page({ th.setData({ all_pick_list: e.data.data.pageData }); - + //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- - if (th.data.sales_rules >= 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ([1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 || is_normal == 1)) { + if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ([1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 || is_normal == 1)) { setTimeout(function () { th.deal_pickup_dline(e); }, 800) @@ -3939,7 +4052,7 @@ Page({ } if (th.data.fir_def_store && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || (th.data.def_pick_store && th.data.def_pick_store.distr_type == g_distr_type))) { - th.data.fir_def_store.Qty; + th.data.fir_def_store.Qty=Qty; if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) th.setData({ def_pick_store: th.data.fir_def_store @@ -4946,7 +5059,6 @@ Page({ var th = this; var ind = parseInt(e.currentTarget.dataset.it); - //如果是拼单活动的普通购买 if (ind == 1) { @@ -4959,14 +5071,14 @@ Page({ th.get_sto(1); th.setData({ is_normal: ind, - openSpecModal_pt: 1 + openSpecModal_pt: 1, }); } else { th.get_sto(1); th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { th.setData({ is_normal: ind, - openSpecModal_pt: 1 + openSpecModal_pt: 1, }); }); } @@ -4975,6 +5087,10 @@ Page({ if (th.data.is_normal) { th.data.g_buy_num = new Map(); + th.setData({ + goodsInputNum: mo_num, + mo_num:mo_num + }); } //拼单商品从这里进,先判断有没有买过商品, @@ -5041,7 +5157,6 @@ Page({ getApp().confirmBox("拼团商品至少要买" + qnum + "件!"); return false; } - } th.addcart_pt_func(); @@ -5065,9 +5180,10 @@ Page({ if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { wx.showToast({ - title: '超出商品限购', - icon: 'none', + title: '超出商品限购', + icon: 'none', }); + // s.my_warnning('超出商品限购', 0, th); var num = th.data.prom_buy_limit - th.data.prom_buy_num; if (num < 0) num = 0; @@ -5146,9 +5262,10 @@ Page({ // return s.my_warnning("商品数量不能为0", 0, th); }; if (th.data.goodsInputNum > o.store_count) { - th.setData({ - goodsInputNum: o.store_count - }) + + // th.setData({ + // goodsInputNum: o.store_count + // }) wx.showToast({ title: '超出商品库存', icon: 'none', @@ -6919,7 +7036,7 @@ Page({ var lock = 0; //---如果是活动的时候,同时不是普通购买--- - if (th.data.sele_g.whsle_id || [1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) > -1 && !th.data.is_normal) { + if (getApp().is_virtual(th.data.sele_g) || th.data.sele_g.whsle_id || ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) > -1 && !th.data.is_normal)) { func(); return false; } @@ -6954,6 +7071,10 @@ Page({ async check_CanOutQty(goodsinfo, item, func) { var sales_rules = this.data.sales_rules; + //如果默认是商品 + if(getApp().is_virtual(goodsinfo)){ + return func(100000); + } var lock_rq = { store_id: os.stoid, @@ -7357,19 +7478,19 @@ Page({ }) }, - //---检查有没有优惠活动--- - check_is_youhui:async function (gid, is_nor) { + //---检查有没有优惠活动--- is_nor的普通购买的时候,is_spec是切换规格的时候 + check_is_youhui:async function (gid, is_nor,is_spec) { var th = this; var user_id = getApp().globalData.user_id; if (!user_id) user_id = 0; //普通购买的时候,重新算一下组合购有没有 - if(is_nor){ + if(is_nor || is_spec){ var arr3=null; var url = '/api/weshop/activitylist/listGoodActInfo2New'; var req_d = { "store_id": os.stoid, - "goods_id": this.data.gid, + "goods_id": gid, "user_id": user_id, } await getApp().request.promiseGet(url, { @@ -7397,20 +7518,28 @@ Page({ } if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { //-- 获取商品列表 -- - th.data.zh_act=e.data.data; + + if(is_spec){ + th.setData({ + zh_act:e.data.data + }) + }else{ + th.data.zh_act=e.data.data; + } + th.getUserBuyPromNum(e.data.data.id) } } }) } } - + var r_data=null; //调用接口判断订单优惠, await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gid + "/0" + "/" + user_id, { }).then(async res=>{ if (res.data.code == 0 && res.data.data) { - var r_data = res.data.data; + r_data = res.data.data; var max = 0, min = 0; //暂时积分够 不和 优惠,阶梯重叠 if(th.data.zh_act){ @@ -7435,42 +7564,6 @@ Page({ r_data.promGoodsLists=null; } - - if (r_data.ladderLists) { - var act_id = r_data.ladderLists[0].form_id; - //-- 判断会员能不能参与阶梯促销 -- - await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => { - if (res.data.code == 0 && res.data.data) { - var prom_content = ""; - - //暂定优惠促销还不能重叠 - if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){ - return false; - } - - if(res.data.data.good_object==1){ - r_data.promGoodsLists=null; - } - - for (let jj in r_data.ladderLists) { - if (r_data.ladderLists[jj].discount == 10) { - prom_content += "第" + (parseInt(jj) + 1) + "件原价,"; - } else { - prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,"; - } - } - prom_content = ut.sub_last(prom_content); - th.data.prom_type = 10; - th.data.prom_id = act_id; - th.setData({ - jieti_prom: prom_content, - ladder_act_id: act_id - }) - } - }) - } - - //普通购买不在界面显示 if(is_nor){ th.data.collocationGoods=r_data.collocationPromList; @@ -7486,8 +7579,54 @@ Page({ } }) + //-- 如果有阶梯购的时候 -- + if (r_data && r_data.ladderLists) { + var act_id = r_data.ladderLists[0].form_id; + //-- 判断会员能不能参与阶梯促销 -- + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => { + if (res.data.code == 0 && res.data.data) { + var prom_content = ""; + + //暂定优惠促销还不能重叠 + if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){ + return false; + } + + if(res.data.data.good_object==1){ + r_data.promGoodsLists=null; + } + + for (let jj in r_data.ladderLists) { + if (r_data.ladderLists[jj].discount == 10) { + prom_content += "第" + (parseInt(jj) + 1) + "件原价,"; + } else { + prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,"; + } + } + prom_content = ut.sub_last(prom_content); + th.data.prom_type = 10; + th.data.prom_id = act_id; + th.setData({ + jieti_prom: prom_content, + ladder_act_id: act_id + }) + } + }) + } + + //-- 如果有促销活动也算是有参与活动,参与活动的也统一不进行计算起订的数量 -- + this.data.is_act=0; + if(this.data.zh_act || this.data.prom_goods || this.data.jieti_prom || this.data.collocationGoods ){ + this.data.is_act=1; + } + console.log("11111111-gd"); + console.log(th.data.sele_g); + //-- 更新默认购买的数量 --- + var mo_num=getApp().get_limit_qty(th.data.sele_g,this.data.is_act); + this.setData({goodsInputNum:mo_num}) + this.setData({mo_num:mo_num}) }, @@ -7550,9 +7689,8 @@ Page({ openSpecModal_inte: 1, goodsInputNum: 1 }); - - }, + //-- 积分购普通购买 -- go_pay_integral_normal: function () { @@ -7924,7 +8062,10 @@ Page({ let id = e.currentTarget.dataset.id; // 获取礼包id let flag = e.currentTarget.dataset.flag; let url = ''; - if (flag == 1) { // flag =1 控制跳转到专享礼包 + if (flag == 2) { // flag =1 控制跳转到专享礼包 + url = `/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo?isBuy=1&id=${id}&is_act=1`; + // url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; + } else if (flag == 1) { // flag =1 控制跳转到专享礼包 url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; } else { url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮 @@ -8068,10 +8209,11 @@ Page({ openSpecModel_Nor: function () { this.data.g_buy_num = new Map(); var th = this; + this.setData({ open_ind_store: 5, - goodsInputNum: 1 }); //拼团直接给4 + if (th.data.sku_g_pt) { this.get_sto(1) this.setData({ diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index 7997753..3fa9e37 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -3,7 +3,7 @@ - + @@ -97,10 +97,10 @@ - ¥{{prom_price}} + ¥{{prom_price}} - 零售价:¥{{filters.toFix(data.market_price,2)}} - ¥{{filters.toFix(data.shop_price,2)}} + 零售价:¥{{filters.toFix(data.market_price,2)}} + ¥{{filters.toFix(data.shop_price,2)}} @@ -128,8 +128,8 @@ {{prom_price}} - 零售价:¥{{filters.toFix(data.market_price,2)}} - ¥{{filters.toFix(data.shop_price,2)}} + 零售价:¥{{filters.toFix(data.market_price,2)}} + ¥{{filters.toFix(data.shop_price,2)}} @@ -535,6 +535,7 @@ 送{{item.lbtitle}} 送{{item.zxlbtitle}} + 送{{item.monthgiftbag_title}} @@ -684,7 +685,7 @@ (配送不匹配) - + (库存不足) @@ -1264,12 +1265,19 @@ 已售:{{sele_g.sales_sum}} + - - 可售:{{def_pick_store.CanOutQty}} - - 可售:0 + + + + + 可售:{{def_pick_store.CanOutQty}} + + 可售:0 + + + 可售:{{sele_g.store_count}} @@ -1314,7 +1322,7 @@ (库存不足) (配送不匹配) - + (库存不足) @@ -1361,8 +1369,11 @@ ,送赠品 ,送礼包 ,送专享礼包 + ,送每月礼包 + + 配送不匹配 @@ -1393,9 +1404,13 @@ + + + - + + 库存不足 @@ -1411,7 +1426,7 @@ - + 库存不足 @@ -1638,7 +1653,7 @@ {{item.pickup_name}} - (库存不足) + (库存不足) diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index 715bb1e..0766a90 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -481,7 +481,7 @@ - + diff --git a/pages/template/index.wxml b/pages/template/index.wxml index 0c62bce..7ca759f 100644 --- a/pages/template/index.wxml +++ b/pages/template/index.wxml @@ -38,7 +38,7 @@ - + diff --git a/pages/user/add_address/add_address.wxml b/pages/user/add_address/add_address.wxml index 757adf3..1a61698 100644 --- a/pages/user/add_address/add_address.wxml +++ b/pages/user/add_address/add_address.wxml @@ -7,7 +7,7 @@ 收货人 - + 手机号码 diff --git a/pages/user/assistance/giftpacklist.wxss b/pages/user/assistance/giftpacklist.wxss index d21cbd5..63bda66 100644 --- a/pages/user/assistance/giftpacklist.wxss +++ b/pages/user/assistance/giftpacklist.wxss @@ -93,7 +93,8 @@ .box_ware_img image.data-v-3a5b7e36 { /* width: 185rpx; height: 190rpx; *//* background-color: rgba(138, 138, 138, 0.63); */ - border: 2rpx solid #999; + border: 2rpx solid #fafaf9; + border-radius: 4rpx; width: 120rpx; height: 120rpx; background-color:#f8f8f8; diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 5ab3214..3e3573c 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -105,7 +105,7 @@ Page({ } }else{ - app.getUserFir(); + // app.getUserFir(); } this.init_user_tool() }, @@ -616,14 +616,22 @@ Page({ //--跳转到预存款页面-- deposit: function () { - if (!this.data.userInfo) return false; + if (!this.data.userInfo) + { + this.gobindtel(); + return false; + } wx.navigateTo({ url: '/packageD/pages/user/deposit/deposit', }) }, //--跳转到余额页面-- balance: function () { - if (!this.data.userInfo) return false; + if (!this.data.userInfo) + { + this.gobindtel(); + return false; + }; wx.navigateTo({ url: '/packageD/pages/user/member/menber', }) @@ -631,7 +639,11 @@ Page({ //--跳转到优惠券-- coupon: function () { var th = this; - if (!this.data.userInfo) return false; + if (!this.data.userInfo) + { + this.gobindtel(); + return false; + }; // th.sendsm(); wx.navigateTo({ url: '/packageD/pages/user/coupons/coupons', @@ -639,7 +651,11 @@ Page({ }, //--跳转到积分-- integral: function () { - if (!this.data.userInfo) return false; + if (!this.data.userInfo) + { + this.gobindtel(); + return false; + } wx.navigateTo({ url: '/packageD/pages/user/integral/integral', }) @@ -652,7 +668,11 @@ Page({ }, go_order: function (e) { - if (!this.data.userInfo) return false; + if (!this.data.userInfo) + { + this.gobindtel(); + return false; + }; var url = e.currentTarget.dataset.url; wx.navigateTo({ url: url, @@ -991,10 +1011,23 @@ Page({ //过滤掉分销关闭的 let distribut_end_time = await getApp().user_tools_endTime(2);//过滤掉分销到期的 await getApp().promiseGet("/api/weshop/storeDistribut/get/" + os.stoid, {}).then(rs => { - if (rs.data.code == 0) { - var dis = rs.data.data; + if (rs.data.code == 0 || !rs.data.data) { + var is_ok=1; + + if(!distribut_end_time){ + is_ok=0; + } + else if(!rs.data.data){ + is_ok=0; + }else{ + var dis=rs.data.data; + if(!dis || dis.switch == 0){ + is_ok=0; + } + } + for (var i in d_list) { - if (d_list[i].name == '我的分销' && (!dis || dis.switch == 0) || (d_list[i].name == '我的分销' && !distribut_end_time)) { + if (d_list[i].name == '我的分销' && !is_ok) { d_list.splice(i, 1); } } diff --git a/pages/user/my_service/i_service.wxml b/pages/user/my_service/i_service.wxml index 2cc1e0c..f0928ad 100644 --- a/pages/user/my_service/i_service.wxml +++ b/pages/user/my_service/i_service.wxml @@ -34,7 +34,7 @@ - {{item.ServiceName}} + {{item.ServiceName}} diff --git a/pages/user/my_service/i_service.wxss b/pages/user/my_service/i_service.wxss index 4e7f96e..071f783 100644 --- a/pages/user/my_service/i_service.wxss +++ b/pages/user/my_service/i_service.wxss @@ -25,7 +25,7 @@ page { .rel { background-color: rgb(255, 255, 255); width: 346rpx; - height: 430rpx; + min-height: 460rpx; border-radius: 20rpx; display: inline-block; /* margin-right: 15rpx; */ @@ -64,10 +64,11 @@ page { .itemName { margin-bottom: 25rpx; color: rgb(48, 48, 48); + height: 64rpx; } .itemName .Name { - max-width: 250rpx; + max-width: 290rpx; text-align: center; } diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js index 76707b0..ec840be 100644 --- a/pages/user/order_detail/order_detail.js +++ b/pages/user/order_detail/order_detail.js @@ -80,7 +80,15 @@ Page({ r.order_status_detail="待支付"; r.pay_btn=1; } if (r.order_status == 1 && r.pay_status == 1 && r.shipping_status== 0) - r.order_status_detail = "待发货"; + //自提的话 + if (r.exp_type==1) + { + r.order_status_detail = "待自提"; + } + else + { + r.order_status_detail = "待发货"; + } if (r.order_status == 1 && r.pay_status == 1 && r.shipping_status == 1){ r.order_status_detail = "待收货";r.receive_btn=1; @@ -651,7 +659,7 @@ Page({ } //--如果是线下库存的时候-- - if(th.data.conf.sales_rules==2 && !gg.whsle_id){ + if(th.data.conf.sales_rules>=2 && !gg.whsle_id){ var ob={}; await th.check_down_line_next(gg,good.goods_num,order.pickup_id,function(obj){ ob=obj; @@ -953,8 +961,13 @@ Page({ //---检验线下库存的数量的子函数--- async check_down_line_next(gg,num,pick_id,func){ - - var lock=0,pick_no,plist; + //如果默认是商品 + if(getApp().is_virtual(gg)){ + return func(100000); + } + + + var lock=0,pick_no,plist; var lock_rq={store_id:os.stoid,wareId:gg.goods_id,storageId:pick_id}; if(this.data.sales_rules==3){ log_rq.appoint_pick_keyid=this.data.appoint_pick_keyid; diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 7553b06..c8385ec 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -1249,6 +1249,11 @@ Page({ //---检验线下库存的数量的子函数--- async check_down_line_next(gg, num, pick_id, func) { + //如果默认是商品 + if(getApp().is_virtual(gg)){ + return func(100000); + } + var lock = 0, pick_no, plist; var log_rq = { store_id: os.stoid, wareId: gg.goods_id, storageId: pick_id }; if (this.data.sales_rules == 3) { @@ -1667,7 +1672,7 @@ Page({ //判断是不是线下库存的购买, 是不是秒杀活动 - if (th.data.sales_rules >= 2 && !prom && !good.whsle_id) { + if (!getApp().is_virtual(good) && th.data.sales_rules >= 2 && !prom && !good.whsle_id) { //-- 看一下购物车上有多少商品 -- var cart_num = 0; @@ -2467,6 +2472,8 @@ Page({ let user_id = oo.user_id; let flag = true; + let th=this; + // 如果是普通购买或单独购买,不用判断 // 如果是秒杀购买:1、判断活动是否变化;2、是否超出限购 diff --git a/pages/user/order_list/order_list.wxml b/pages/user/order_list/order_list.wxml index f338b31..93c921b 100644 --- a/pages/user/order_list/order_list.wxml +++ b/pages/user/order_list/order_list.wxml @@ -71,8 +71,14 @@ - 待发货 - 待收货 + + 待自提 + 待发货 + + + 待自提 + 待发货 + 待评价 @@ -92,8 +98,14 @@ 已退款 已支付,待成团 未支付 - 待发货 - 待收货 + + 待自提 + 待发货 + + + 待自提 + 待发货 + 待评价 @@ -109,7 +121,10 @@ 组团中 未支付 - 待发货 + + 待自提 + 待发货 + 待收货 待评价 diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index a89e846..370e3a3 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -5,7 +5,7 @@ function e(e, a, r) { configurable: !0, writable: !0 }) : e[a] = r, e; -} +} var a = getApp(), r = a.globalData.setting, diff --git a/pages/user/userinfo/userinfo.wxml b/pages/user/userinfo/userinfo.wxml index 163350c..bd35eaa 100644 --- a/pages/user/userinfo/userinfo.wxml +++ b/pages/user/userinfo/userinfo.wxml @@ -170,7 +170,7 @@ 姓名 - + +{{reg_info.name}}积分 +{{reg_info.name}}成长值 diff --git a/utils/filter.wxs b/utils/filter.wxs index c74dce0..a3f3eb5 100644 --- a/utils/filter.wxs +++ b/utils/filter.wxs @@ -289,4 +289,8 @@ module.exports = { isExpired: filters.isExpired, gettimestamp: filters.gettimestamp, showStartAndEndDate: filters.showStartAndEndDate, + is_virtual_gd:function (is_virtual){ + if(is_virtual==2) return true; + return false; + } } \ No newline at end of file