diff --git a/app.js b/app.js index 5397c7e..60ba32e 100644 --- a/app.js +++ b/app.js @@ -1353,6 +1353,42 @@ App({ }) }, + //--- 统一跳转到物流的优化 --- + async check_go_fw(goods_id,func){ + + var user_id=this.globalData.user_id?this.globalData.user_id:0; + var flag=null; + //判断拼团的---会员身份-- + await this.promiseGet("/api/weshop/teamlist/pageteam/2", { + data: { + store_id: os.stoid, + is_end: 0, + is_show: 1, + user_id: user_id, + pageSize: 1000, + goods_id:goods_id + } + }).then(res => { + let pd_list = res.data.data.pageData; + if (res.data.code == 0 && pd_list.length > 0) { + flag = pd_list.find(pd => { + return pd.goods_type==1; + }) + } + }) + + var url= "/packageA/pages/goodsInfo/goodsInfo?goods_id="+goods_id; + if(flag){ + url='/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo?goods_id='+goods_id+'&prom_type=6&prom_id='+flag.id; + } + if(func){ + func(flag,url) + }else{ + this.goto(url); + } + + + }, //-- 如果是新会员没有地址的时候,自提的时候可以不用管 -- is_no_addr(th,exp_type){ exp_type=parseInt(exp_type+''); @@ -1362,7 +1398,7 @@ App({ } return false; }, - //---- 判断是不是虚拟商品狗阿米 ----- + //---- 判断是不是虚拟商品 ----- is_virtual(gd){ if(gd.is_virtual==2) return true; return false; @@ -1413,7 +1449,10 @@ App({ }) } return cx_arr; - } + }, + + + }); -}); + diff --git a/app.json b/app.json index 153f35a..934ee9d 100644 --- a/app.json +++ b/app.json @@ -116,10 +116,12 @@ "pages/cart2_ser/cart2_ser", "pages/libao_payment/payment", "pages/details_serviceCard/details_serviceCard", - "pages/serviceCard_pd/goodsInfo/goodsInfo", - "pages/serviceCard_pd/team_show/team_show", - "pages/serviceCard_pd/cart/cart", - "pages/serviceCard_pd/team_success/team_success" + "pages/serviceCard_pd/goodsInfo/goodsInfo", + "pages/serviceCard_pd/team_show/team_show", + "pages/serviceCard_pd/cart/cart", + "pages/serviceCard_pd/team_success/team_success", + "pages/serviceCard_pd/cart_wk/cart_wk", + "pages/serviceCard_pd/team_more/team_more" ] }, { diff --git a/app.wxss b/app.wxss index 2e197c2..3e5ba4b 100644 --- a/app.wxss +++ b/app.wxss @@ -1211,7 +1211,7 @@ background: #ffe3e2; .no_line_x{ text-decoration: none !important; font-size: 24rpx !important; - color: #acaaaa !important; + /*color: #acaaaa !important;*/ } .no_line_c{ text-decoration: none !important; diff --git a/components/diy_pingd_buy/diy_pingd_buy.js b/components/diy_pingd_buy/diy_pingd_buy.js index 1b5e23d..6957bd9 100644 --- a/components/diy_pingd_buy/diy_pingd_buy.js +++ b/components/diy_pingd_buy/diy_pingd_buy.js @@ -49,12 +49,15 @@ Component({ clearInterval(this.data.timer); } }, - - + ready: function() { console.log("ready"); var g_id = this.data.object.data; + var data_type = this.data.object.data_type; console.log(g_id); + if(data_type!=2){ + g_id=null; + } this.init(g_id); }, detached() { @@ -219,7 +222,7 @@ Component({ bind_bnerr3: function (e) { var _errImg = e.target.dataset.errorimg; var _Img = e.target.dataset.img; - if (_Img != undefined) { + if (_errImg != undefined) { var _errObj = {}; _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; diff --git a/packageA/pages/cart2_ser/cart2_ser.js b/packageA/pages/cart2_ser/cart2_ser.js index 6cd7c92..7a22e7b 100644 --- a/packageA/pages/cart2_ser/cart2_ser.js +++ b/packageA/pages/cart2_ser/cart2_ser.js @@ -510,6 +510,9 @@ Page({ 'pickup_id': gg.pick_id, 'pickup_keyid': list[i].keyid, }; + if(gg.is_pd_normal){ + goods.is_pd_normal=1; + } } if(getApp().globalData.skinface_id){ @@ -562,6 +565,11 @@ Page({ goods.skinface_id=getApp().globalData.skinface_id; } + if(this.data.postdata && this.data.postdata.is_pd_normal==1){ + goods.is_pd_normal=1; + } + + //--导购分享过来的id-- if (gg.guide_id) { goods.guide_id = gg.guide_id; diff --git a/packageA/pages/details_serviceCard/details_serviceCard.js b/packageA/pages/details_serviceCard/details_serviceCard.js index d8ea6ed..86b0ed0 100644 --- a/packageA/pages/details_serviceCard/details_serviceCard.js +++ b/packageA/pages/details_serviceCard/details_serviceCard.js @@ -4,6 +4,7 @@ const app = getApp(); const os = app.globalData.setting; let self = null; var util = require('../../../utils/util.js'); +const ut = require("../../../utils/util.js"); Page({ @@ -70,8 +71,13 @@ Page({ }).then(res => { if (res.data.code == 0) { // console.log('请求成功', res); + var dd=res.data.data.pageData[0]; + dd.prom_type=dd.list[0].prom_type; + dd.pt_status=dd.list[0].pt_status; + dd.pt_tail_money=dd.list[0].pt_tail_money; + this.setData({ - details: res.data.data.pageData[0], + details: dd, }); } else { throw (res); @@ -306,6 +312,9 @@ Page({ var card_id = details.list[i].card_id; var prom_type = details.list[i].prom_type > 0 ? details.list[i].prom_type : 0; var is_pd_normal = details.list[i].is_pd_normal; + if(is_pd_normal){ + newd['is_pd_normal'] = 1; + } // 库存 var redisNums = 0; // 限购数 @@ -356,6 +365,12 @@ Page({ } + if(prom_type==6){ + wx.showModal({ + title: details.list[i].service_name +"拼团商品不加入购物车\n" + }); + return false; + } //----先看会员在购物车中是否加入了该商品----- app.request.get("/api/weshop/cartService/page", { @@ -499,7 +514,7 @@ Page({ // 立即支付 - pay() { + async pay() { if(this.data.is_summit_ing) return false; this.data.is_summit_ing=1; @@ -508,54 +523,211 @@ Page({ let order_sn = this.data.details.order_sn; let order_id = this.data.details.order_id; let store_id = app.globalData.setting.stoid; - t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder"); - t_pay.pay({ - parentSn: order_sn, - store_id: store_id - }, function () { - app.showWarning('支付成功'); - setTimeout(function() { - wx.reLaunch({ - url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + order_id, - }) - }, 1000) - - }, function (e) { - th.data.is_summit_ing=0; - wx.showToast({ - title: e, - icon: 'none', - duration: 2000 - }); - }) - // app.request.post('/api/weshop/order/pay/createRechargeOrder', { - // data: { - // parentSn: order_sn, - // store_id: store_id, - // }, - // - // success: function(res) { - // var n = res.data.data; - // self.weixinPay(n, function() { - // app.showWarning('支付成功'); - // // setTimeout(function() { - // // wx.reLaunch({ - // // url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + order_id, - // // }) - // // }, 1000) - // }, function() { - // app.showWarning('支付失败'); - // // setTimeout(function() { - // // wx.reLaunch({ - // // url: '/packageA/pages/cardList/cardList', - // // }) - // // }, 1000) - // }); - // } - // }) - }, + let user_id = os.user_id; + + let flag = true; + // 如果是普通购买或单独购买,不用判断 + // 如果是秒杀购买:1、判断活动是否变化;2、是否超出限购 + let list = this.data.details.list; + var pt_act=null; //-- 拼团活动的优化 -- + + //秒杀活动和拼团活动要重新计算一下 + for (const it of list) { + if (it.prom_type == 1) { + let act_details = null; + let redis_num = 0; + let promcardbuynum = 0; + let qty = it.qty; + + + await getApp().request.promiseGet('/api/ms/flash_sale/getNew/' + store_id + '/' + user_id + '/' + it.prom_id, {}).then(res => { + console.log('11111111====>>>'); + if (res.data.code == 0) { + console.log('当前的秒杀活动信息:', res.data.data); + act_details = res.data.data; + if (act_details.is_end == 1) { + wx.showModal({ + title: '提示', + content: '活动已结束,无法支付,请取消订单!', + showCancel: false, + }); + flag = false; + return false; + }; + if (act_details.id != it.prom_id) { + wx.showModal({ + title: '提示', + content: '活动发生了变化,无法支付,请取消订单,重新购买!', + showCancel: false, + }); + flag = false; + return false; + }; + + + var t_now = ut.gettimestamp(); + if (act_details.is_end == 0 && act_details.start_time < t_now && act_details.end_time > t_now) { + wx.showModal({ + title: '提示', + content: '活动发生了变化,无法支付,请取消订单,重新购买!', + showCancel: false, + }); + flag = false; + return false; + } + + }; + }); + + if(act_details.buy_limit>0 && flag){ + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { + data: { + store_id: store_id, + user_id: user_id, + card_id: it.card_id, + prom_type: it.prom_type, + prom_id: it.prom_id, + ispay:1 + } + }).then(res => { + + if (res.data.code == 0) { + promcardbuynum = res.data.data.promcardbuynum; + let canBuyNum = act_details.buy_limit - promcardbuynum; // 自己还可购买的数量c + + if (canBuyNum < qty) { + wx.showModal({ + title: '提示', + content: '您已超出活动限购数量,无法支付,请取消订单!', + showCancel: false, + }); + flag = false; + } + } + }) + } + + }; + if (it.prom_type == 6) { + let act_details = null; + let redis_num = 0; + let promcardbuynum = 0; + let qty = it.qty; + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + store_id + "/" + it.prom_id, {}).then(res => { + + if (res.data.code == 0) { + + act_details = res.data.data; + + if (act_details.is_end == 1) { + wx.showModal({ + title: '提示', + content: '活动已结束,无法支付,请取消订单!', + showCancel: false, + }); + flag = false; + return false; + } + + if (act_details.id != it.prom_id) { + wx.showModal({ + title: '提示', + content: '活动发生了变化,无法支付,请取消订单,重新购买!', + showCancel: false, + }); + flag = false; + return false; + } + + var t_now = ut.gettimestamp(); + if (act_details.is_end == 1 || act_details.start_time > t_now || act_details.end_time < t_now) { + wx.showModal({ + title: '提示', + content: '活动发生了变化,无法支付,请取消订单,重新购买!', + showCancel: false, + }); + flag = false; + return false; + } + + }; + }); + + if(act_details.buy_limit>0){ + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { + data: { + store_id: store_id, + user_id: user_id, + card_id: it.card_id, + prom_type: it.prom_type, + prom_id: it.prom_id, + ispay:1 + } + }).then(res => { + if (res.data.code == 0) { + console.log('已经购买的数量:', res.data.data); + promcardbuynum = res.data.data.promcardbuynum; + } + }) + let limited = act_details.buy_limit; // 限购数量a + let canBuyNum = limited - promcardbuynum; // 自己还可购买的数量c + + if (canBuyNum < qty ) { + wx.showModal({ + title: '提示', + content: '您已超出活动限购数量,无法支付,请取消订单!', + showCancel: false, + }); + flag = false; + } + } + pt_act=act_details; + } + } + + if (flag) { + t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder"); + t_pay.pay({ + parentSn: order_sn, + store_id: store_id + }, function () { + app.showWarning('支付成功'); + + if(pt_act.kttype==1){ + //--如果商家团的时候--- + getApp().request.promisePost("/api/weshop/order/pay/vipAutoTuan", { + data: {orderSn:order_sn,storeId:os.stoid } + }) + } + + setTimeout(function () { + wx.reLaunch({ + url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + order_id, + }) + }, 1000) + + }, function (e) { + th.data.is_summit_ing = 0; + wx.showToast({ + title: e, + icon: 'none', + duration: 2000 + }); + }) + }else{ + this.data.is_summit_ing=0; + } + + }, + + //-- 支付尾款 -- + pay2(){ + var url="/packageA/pages/serviceCard_pd/cart_wk/cart_wk?order_id="+this.data.details.order_id; + getApp().goto(url); + }, + //------调起支付框-------- weixinPay: function(n, success, fail) { if (!n) return false; diff --git a/packageA/pages/details_serviceCard/details_serviceCard.wxml b/packageA/pages/details_serviceCard/details_serviceCard.wxml index 71e61af..c9da4ae 100644 --- a/packageA/pages/details_serviceCard/details_serviceCard.wxml +++ b/packageA/pages/details_serviceCard/details_serviceCard.wxml @@ -8,8 +8,17 @@ {{item.pickup_name}} - 待支付 - 待评价 + + + 未支付 + 组团中 + 待支付尾款 + + + 待支付 + + + 待评价 已评价 已取消 已作废 @@ -39,7 +48,9 @@ - 共{{filter.count(details.list)}}件商品,合计:{{details.account}} + + 共{{filter.count(details.list)}}件商品,合计:{{filter.toFix(details.account+details.pt_tail_money,2) }} + @@ -68,14 +79,24 @@ - + - - + + + + @@ -164,8 +166,8 @@ - - diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml index 00a4994..26fbc72 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml @@ -50,8 +50,8 @@ - - {{def_pick_store.pickup_name}} + + {{def_pick_store.pickup_name}} diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml index 7836bb4..89c9c35 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml @@ -1368,7 +1368,7 @@ - + {{item.pickup_name}} diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss index a117d2a..e6ecb83 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss @@ -3120,6 +3120,7 @@ button.custom-service::after{ overflow-y: auto; } + .searchbar { height: 95rpx; border-bottom: 2rpx solid rgb(238, 238, 238); @@ -3143,3 +3144,7 @@ button.custom-service::after{ border: 2rpx solid rgb(238, 238, 238); padding-left: 30rpx; } +.shop_name.max{ + max-width:370rpx; flex-shrink: 0; +} + diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 8f40d0d..5889794 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -937,7 +937,7 @@ Page({ continue; } - if (item.prom_type == 0) { + if (item.prom_type == 0 && !item.is_integral_normal && !item.is_pd_normal ) { var prom = null; var now = ut.gettimestamp(); await getApp().request.promiseGet(`/api/weshop/activitylist/listGoodActInfo2`, { diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index a253e05..12d0f9f 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -311,6 +311,7 @@ Page({ jsarr.forEach(function (value, index) { if (count >= value['rynum']) price = value['price']; }) + var tail_money = (price * order_goods.goods_num - order['order_amount'] - order['user_money']).toFixed(2); tail_money = parseFloat(tail_money); diff --git a/pages/goods/goodsInfo/buy_integral.wxml b/pages/goods/goodsInfo/buy_integral.wxml index 4e47ae6..a15a554 100644 --- a/pages/goods/goodsInfo/buy_integral.wxml +++ b/pages/goods/goodsInfo/buy_integral.wxml @@ -28,6 +28,7 @@ {{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"}} diff --git a/pages/goods/goodsInfo/buy_pt.wxml b/pages/goods/goodsInfo/buy_pt.wxml index 896489e..8883f33 100644 --- a/pages/goods/goodsInfo/buy_pt.wxml +++ b/pages/goods/goodsInfo/buy_pt.wxml @@ -51,8 +51,6 @@ {{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"}} diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index fa45f00..debf06f 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -130,7 +130,6 @@ {{prom_price}} - 零售价:¥{{filters.toFix(data.market_price,2)}} ¥{{filters.toFix(data.shop_price,2)}} diff --git a/pages/goods/goodsInfo/goodsInfo.wxss b/pages/goods/goodsInfo/goodsInfo.wxss index 3bfe10d..bdc5b7c 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxss +++ b/pages/goods/goodsInfo/goodsInfo.wxss @@ -3135,8 +3135,8 @@ xc-ensure-div { } .xc-qt-price .xc-qtunit-price { - margin-left: 6rpx; - margin-top: -4rpx; + /*margin-left: 6rpx;*/ + /*margin-top: -4rpx;*/ } .xc-nanber { diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 96b7c3d..88aae79 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -316,7 +316,7 @@ Page({ } //--正再拼团中的处理-- - var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" + var url = "/api/weshop/order/pageTuanNew?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" await getApp().request.promiseGet(url, {}).then(res => { if (res.data.code == 0 && res.data.data && res.data.data.pageData) { th.data.pt_timer_arr = res.data.data.pageData; diff --git a/pages/team/team_ping/team_ping.js b/pages/team/team_ping/team_ping.js index dbee1f7..fdf5ece 100644 --- a/pages/team/team_ping/team_ping.js +++ b/pages/team/team_ping/team_ping.js @@ -92,8 +92,7 @@ Page({ //获取订单表的信息根据活动user_id,pt_prom_id>0 AND pay_time>0 - - await getApp().request.promiseGet("/api/weshop/order/pageTuan?"+where, { + await getApp().request.promiseGet("/api/weshop/order/pageTuanNew?"+where, { data: { is_pt:1,store_id: os.stoid, user_id: user_id, pageSize: 6, page: this.data.currentPage,} }).then(res => { order = res.data.data.pageData; @@ -102,82 +101,130 @@ Page({ wx.showLoading({ title: "加载中"}); - for (i = 0; i < order.length; i++) { - //获取订单从表信息 - await getApp().request.promiseGet("/api/weshop/ordergoods/pageGoods", { - data: { store_id: os.stoid, order_id: order[i].order_id } - }).then(res => { - order_goods = res.data.data.pageData; - order[i].order_goods = order_goods; - order[i].gimage = ee.data.imageurl + order_goods[0]?.original_img; - }) + if(order && order.length){ + for (i = 0; i < order.length; i++) { - - //获取订单表信息根据上面查询的订单号order[i].pt_listno - await getApp().request.promiseGet("/api/weshop/order/pagePtList", { - data: { store_id: os.stoid, pt_listno: order[i].pt_listno,pageSize:60,page:1} - }).then(res => { - //console.log("ordertx"); - ordertx = res.data.data.pageData; - //console.log(ordertx); - order[i].tx=ordertx; - }) + //获取teamgroup中的值 + await getApp().request.promiseGet("/api/weshop/teamgroup/page", { + data: { store_id: os.stoid, listno: order[i].pt_listno,pageSize:1,page:1} + }).then(res => { + team_g = res.data.data.pageData[0] + }) - //获取teamgroup中的值 - await getApp().request.promiseGet("/api/weshop/teamgroup/page", { - data: { store_id: os.stoid, listno: order[i].pt_listno,pageSize:1,page:1} - }).then(res => { - team_g = res.data.data.pageData[0] - - }) - //获取预存使用金额 - await getApp().request.promiseGet("/api/weshop/orderMore/get/" + os.stoid + "/" + order[i].order_sn, { - }).then(res => { - if (res.data.code == 0 && res.data.data) { - // data[ind].use_commission = res.data.data.use_commission; - order[i].pre_cut = res.data.data.pre_cut; //是否使用预存,如果是使用预存不能单品退,只能整单退 - order[i].pre_json = res.data.data.pre_json; //是否使用预存,如果是使用预存不能单品退,只能整单退 + switch (team_g.goods_type){ + case 0: + //获取订单从表信息 + await getApp().request.promiseGet("/api/weshop/ordergoods/pageGoods", { + data: { store_id: os.stoid, order_id: order[i].order_id } + }).then(res => { + order_goods = res.data.data.pageData; + order[i].order_goods = order_goods; + order[i].gimage = ee.data.imageurl + order_goods[0]?.original_img; + }) + + //获取订单表信息根据上面查询的订单号order[i].pt_listno + await getApp().request.promiseGet("/api/weshop/order/pagePtList", { + data: { store_id: os.stoid, pt_listno: order[i].pt_listno,pageSize:60,page:1} + }).then(res => { + //console.log("ordertx"); + ordertx = res.data.data.pageData; + //console.log(ordertx); + order[i].tx=ordertx; + }) + //获取预存使用金额 + await getApp().request.promiseGet("/api/weshop/orderMore/get/" + os.stoid + "/" + order[i].order_sn, { + }).then(res => { + if (res.data.code == 0 && res.data.data) { + // data[ind].use_commission = res.data.data.use_commission; + order[i].pre_cut = res.data.data.pre_cut; //是否使用预存,如果是使用预存不能单品退,只能整单退 + order[i].pre_json = res.data.data.pre_json; //是否使用预存,如果是使用预存不能单品退,只能整单退 + } + }) + break; + + case 1: + + order[i].goods_type=1; + order[i].pre_cut=0; + + //获取order信息根据订单编号order_sn + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/page", { + data: { store_id: os.stoid, order_id: order[i].order_id,} + }).then(res => { + order_goods = res.data.data.pageData; + order_goods[0].goods_num=order_goods[0].qty; + order_goods[0].goods_price=order_goods[0].price; + order[i].order_goods = order_goods; + }) + + + //pt_tail_money 在从表 + order[i].pt_tail_money=order_goods[0].pt_tail_money; + + //-- 获取商品信息 -- + await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + os.stoid + "/" + order_goods[0].card_id, { + }).then(res => { + //-- 商品地址 -- + order[i].gimage = ee.data.imageurl + res.data.data.imgUrl + order[i].order_goods[0].goods_name= res.data.data.serviceName; + }) + + //-- 多少人参团头像 -- + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/pagePtList", { + data: { + store_id: o.stoid, + pt_listno: team_g.listno, + } + }).then(res => { + ordertx = res.data.data.pageData; + order[i].tx=ordertx; + }) + + break; } - }) - - if (order[i].is_zsorder== 4) { - var num = 0; - var jt_data = JSON.parse(order[i].ct_rylist); - for (var m in jt_data) { - if (jt_data[m].rynum > num) num = jt_data[m].rynum; + + if (order[i].is_zsorder== 4) { + var num = 0; + var jt_data = JSON.parse(order[i].ct_rylist); + for (var m in jt_data) { + if (jt_data[m].rynum > num) num = jt_data[m].rynum; + } + order[i].max_ct_num = num; } - order[i].max_ct_num = num; - } - var head=[]; - if(team_g.is_xuni_ct) { + var head=[]; + if(team_g.is_xuni_ct) { head=team_g.xuni_head_id.split(","); order[i].is_xuni_ct=1; - } + } + + var sf_num = order[i].ct_num; + if (order[i].ct_num>=3){ sf_num=3;} + sf_num=sf_num-ordertx.length; + if(sf_num>0) { + var arr = []; + for(var j=0;j=3){ sf_num=3;} - sf_num=sf_num-ordertx.length; - if(sf_num>0) { - var arr = []; - for(var j=0;j0}}"> - + @@ -33,7 +33,11 @@ {{item.order_goods[0].goods_price}} - {{item.order_goods[0].shop_price || item.order_goods[0].market_price}} + diff --git a/pages/team/team_show/team_show.js b/pages/team/team_show/team_show.js index 9980dc6..2e3fcb4 100644 --- a/pages/team/team_show/team_show.js +++ b/pages/team/team_show/team_show.js @@ -982,6 +982,14 @@ Page({ url+="?first_leader="+getApp().globalData.user_id; } + if(url.indexOf('goods_id')==-1){ + url+="&goods_id="+this.data.goods.goods_id; + } + if(url.indexOf('tg_id')==-1){ + url+="&tg_id="+this.data.teamgroup.id; + } + + return { path:url, title: "商品分类", diff --git a/pages/team/team_success/team_success.js b/pages/team/team_success/team_success.js index 17f0cf2..fabddfb 100644 --- a/pages/team/team_success/team_success.js +++ b/pages/team/team_success/team_success.js @@ -84,7 +84,11 @@ Page({ th.setData({poster:json_data}) } } - }) + }) + + getApp().getConfig(function (e) { + th.setData({sto_sele_name_1: e.store_name}) + }) }, onShow:function () { getApp().check_can_share(this); @@ -462,223 +466,227 @@ Page({ var share_title=th.data.teamlist.share_title; if(!share_title) share_title=th.data.teamlist.title; - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); - - //-- 是自定义海报的情况下 -- - if(th.data.poster && parseInt(th.data.poster.style)==2){ - //在线上分享人的情况下 - if(parseInt(th.data.poster.show_headpic)){ - //获取坐标 - var x=parseFloat(th.data.poster.head_x)*2; - var y=parseFloat(th.data.poster.head_y)*2; - var x1=(x+90) *unit; - var y1=(y+50) *unit; - //--昵称--- - context.setFontSize(24 * unit) - context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, x1, y1); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; - //强烈推荐 改许程 - var tj_path = "../../../images/share/q_tj.png"; - context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit); - context.setFontSize(16 * unit) - context.setLineJoin('round'); //交点设置成圆角 - context.setFillStyle("white") - context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit); - } - - }else{ - //--昵称--- - context.setFontSize(24 * unit) - context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; - //强烈推荐 - var tj_path = "../../../images/share/q_tj.png"; - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit); - context.setFontSize(18 * unit) - context.setFillStyle("white") - context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit); - } - - - //---产品名称--- - context.setFontSize(21.3 * unit); - context.setFillStyle("black"); - - - getApp().draw_Text(context,share_title, - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); - //------产品的价格------- - context.setFontSize(24 * unit) - context.setFillStyle("red") - - var pri0 = th.data.teamlist.price; - pri0=parseFloat(pri0).toFixed(2); - var wd1=th.data.screenWidth-ut.measureText(pri0, 31 * unit)-25; - context.fillText("¥", wd1-15, 180 * unit); - context.setFontSize(31 * unit) - context.fillText(pri0, wd1, 180 * unit); - - //---市场价划掉--- - context.setFillStyle("gray") - context.setFontSize(22 * unit) - pri0= "¥" + parseFloat(th.data.goods.market_price).toFixed(2); - var wd2=th.data.screenWidth-ut.measureText(pri0, 22 * unit)-25; - context.fillText(pri0, wd2, 210 * unit); - - context.setStrokeStyle('gray') - context.setLineWidth(1 * unit) - context.moveTo(wd2-5, 204 * unit) - context.lineTo(wd2+ut.measureText(pri0, 22 * unit)+5, 204 * unit) - context.stroke(); - console.log(th.data.share_img_localpath); - - - //---中间大图--- - context.drawImage(th.data.share_img_localpath, 68 * unit, 242 * unit, 410 * unit, 410 * unit); - - var g_ct=th.data.teamlist.ct_num-th.data.ordertx.length; - var wz= ""; - if(g_ct>0) wz="还差"+g_ct+"人成团,"; - else{ - g_ct= th.data.max_num -th.data.ordertx.length; - if(g_ct>0){ - wz="还差"+g_ct+"人享最低优惠,"; + + if (!th.data.share_b_img){ // 如果是普通商品,绘制新海报 + th.drawPoster(context, unit, th.data.share_img_localpath, vpath, type); + } else { + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + //-- 是自定义海报的情况下 -- + if(th.data.poster && parseInt(th.data.poster.style)==2){ + //在线上分享人的情况下 + if(parseInt(th.data.poster.show_headpic)){ + //获取坐标 + var x=parseFloat(th.data.poster.head_x)*2; + var y=parseFloat(th.data.poster.head_y)*2; + var x1=(x+90) *unit; + var y1=(y+50) *unit; + //--昵称--- + context.setFontSize(24 * unit) + context.setFillStyle("black") + context.fillText(app.globalData.userInfo.nickname, x1, y1); + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; + //强烈推荐 改许程 + var tj_path = "../../../images/share/q_tj.png"; + context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit); + context.setFontSize(16 * unit) + context.setLineJoin('round'); //交点设置成圆角 + context.setFillStyle("white") + context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit); + } + }else{ - wz="已享受最优惠,"; + //--昵称--- + context.setFontSize(24 * unit) + context.setFillStyle("black") + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; + //强烈推荐 + var tj_path = "../../../images/share/q_tj.png"; + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit); + context.setFontSize(18 * unit) + context.setFillStyle("white") + context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit); } - } - //-------大图后面就不一样了----------- - switch (type) { - case 1://会员团和商家团的展示 - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 670 * unit) - context.lineTo(520 * unit, 670 * unit) - context.stroke(); - - //---文字--- - context.setFontSize(22 * unit) - context.setFillStyle("black") - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); - - //绘制成团图片 - var ct_img ="../../../images/share/ct_num.png"; - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); - var ct_num = th.data.teamlist.ct_num; - context.setFontSize(14 * unit) - - context.setFillStyle("red") - if(ct_num<10){ - context.fillText(ct_num+"人拼团", 92 * unit, 760 * unit); + + //---产品名称--- + context.setFontSize(21.3 * unit); + context.setFillStyle("black"); + + + getApp().draw_Text(context,share_title, + 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); + //------产品的价格------- + context.setFontSize(24 * unit) + context.setFillStyle("red") + + var pri0 = th.data.teamlist.price; + pri0=parseFloat(pri0).toFixed(2); + var wd1=th.data.screenWidth-ut.measureText(pri0, 31 * unit)-25; + context.fillText("¥", wd1-15, 180 * unit); + context.setFontSize(31 * unit) + context.fillText(pri0, wd1, 180 * unit); + + //---市场价划掉--- + context.setFillStyle("gray") + context.setFontSize(22 * unit) + pri0= "¥" + parseFloat(th.data.goods.market_price).toFixed(2); + var wd2=th.data.screenWidth-ut.measureText(pri0, 22 * unit)-25; + context.fillText(pri0, wd2, 210 * unit); + + context.setStrokeStyle('gray') + context.setLineWidth(1 * unit) + context.moveTo(wd2-5, 204 * unit) + context.lineTo(wd2+ut.measureText(pri0, 22 * unit)+5, 204 * unit) + context.stroke(); + console.log(th.data.share_img_localpath); + + + //---中间大图--- + context.drawImage(th.data.share_img_localpath, 68 * unit, 242 * unit, 410 * unit, 410 * unit); + + var g_ct=th.data.teamlist.ct_num-th.data.ordertx.length; + var wz= ""; + if(g_ct>0) wz="还差"+g_ct+"人成团,"; + else{ + g_ct= th.data.max_num -th.data.ordertx.length; + if(g_ct>0){ + wz="还差"+g_ct+"人享最低优惠,"; }else{ - context.fillText(ct_num+"人拼团", 86 * unit, 760 * unit); + wz="已享受最优惠,"; } - context.setFontSize(22 * unit) - context.fillText("已拼"+th.data.teamlist.buy_num+"份", 166 * unit, 763 * unit); - context.setFillStyle("gray") - context.fillText(wz+"快来和我一起拼团吧!", 40 * unit, 826 * unit); - context.setFillStyle("black") - - context.setFontSize(22 * unit) - context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit); - //---二维吗图--- - //-- 自定义海报 -- - if(th.data.poster){ - var erm_x= parseFloat(th.data.poster.ewm_x)*2; - var erm_y= parseFloat(th.data.poster.ewm_y)*2; - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit); - }else{ - //---二维吗图--- - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); - } - break - case 2://阶梯团的展示 - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 670 * unit) - context.lineTo(520 * unit, 670 * unit) - context.stroke(); - //---文字--- - context.setFontSize(22 * unit) - context.setFillStyle("black") - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); - //---绘制中间阶梯的价格--- - var list= JSON.parse(th.data.teamlist.ct_rylist); - for(var i=0; i{ + th.setData({is_get:0}) + th.onShow(); + },500) + + }, function () { th.setData({ paying: 0 }); }, os.stoid, 1); @@ -2374,7 +2391,17 @@ Page({ }; if (currentIndex == 2) { // 卡项订单 list = th.data.cardList; - list = list.concat(data); + var new_data= data.map((item,index)=>{ + if(item.list && item.list.length){ + item.pt_status=item.list[0].pt_status; + item.pt_tail_money=item.list[0].pt_tail_money; + item.prom_id=item.list[0].prom_id; + item.prom_type=item.list[0].prom_type; + } + return item; + }) + + list = list.concat(new_data); th.setData({ cardList: list }); console.log('currentCard', list); }; @@ -2699,6 +2726,11 @@ Page({ // 卡项订单 - 立即支付 pay: async function (e) { + let th=this; + + if(th.data.ser_paying) return false; + th.data.ser_paying=1; + let index = e.currentTarget.dataset.index; let item = this.data.cardList[index]; let order_sn = item.order_sn; @@ -2706,14 +2738,11 @@ Page({ let store_id = app.globalData.setting.stoid; let user_id = oo.user_id; let flag = true; - - let th=this; - - // 如果是普通购买或单独购买,不用判断 // 如果是秒杀购买:1、判断活动是否变化;2、是否超出限购 - let list = item.list; + var pt_act=null; //-- 拼团活动的优化 -- + for (const it of list) { if (it.prom_type == 1) { let act_details = null; @@ -2723,9 +2752,8 @@ Page({ await getApp().request.promiseGet('/api/ms/flash_sale/getNew/' + store_id + '/' + user_id + '/' + it.prom_id, {}).then(res => { - console.log('11111111====>>>'); + if (res.data.code == 0) { - console.log('当前的秒杀活动信息:', res.data.data); act_details = res.data.data; if (act_details.is_end == 1) { wx.showModal({ @@ -2745,108 +2773,129 @@ Page({ flag = false; return false; }; - }; - }); - await getApp().request.promiseGet('/api/weshop/activitylist/getActLen/' + store_id + '/' + it.prom_type + '/' + it.prom_id, { - 1: 1 - }).then(res => { - console.log('222222222====>>>'); - if (res.data.code == 0) { - // 当前可以购买的数量 - console.log('redis当前可以购买的数量:', res.data.data); - redis_num = res.data.data; - // if(redis_num <=0) { - // wx.showModal({ - // title: '提示', - // content: '活动库存不足,无法支付,请取消订单!', - // showCancel: false, - // }); - // // flag = false; - // return true; - // }; - }; - }); - await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { - data: { - store_id: store_id, - user_id: user_id, - card_id: it.card_id, - prom_type: it.prom_type, - prom_id: it.prom_id, + var t_now = ut.gettimestamp(); + if (act_details.is_end == 1 || act_details.start_time > t_now || act_details.end_time < t_now) { + wx.showModal({ + title: '提示', + content: '活动发生了变化,无法支付,请取消订单,重新购买!', + showCancel: false, + }); + flag = false; + return false; + } + } - }).then(res => { - console.log('333333333====>>>'); - if (res.data.code == 0) { - console.log('已经购买的数量:', res.data.data); - promcardbuynum = res.data.data.promcardbuynum; + }); + if(act_details.buy_limit>0 && flag){ + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { + data: { + store_id: store_id, + user_id: user_id, + card_id: it.card_id, + prom_type: it.prom_type, + prom_id: it.prom_id, + ispay:1 + } + }).then(res => { + if (res.data.code == 0) { + promcardbuynum = res.data.data.promcardbuynum; + let canBuyNum = act_details.buy_limit - promcardbuynum; // 自己还可购买的数量c + + if (canBuyNum < qty) { + wx.showModal({ + title: '提示', + content: '您已超出活动限购数量,无法支付,请取消订单!', + showCancel: false, + }); + flag = false; + } + } + }) + } - let limited = act_details.buy_limit; // 限购数量a - let buyedNum = promcardbuynum; // 自己已经购买的数量b - let canBuyNum = limited - buyedNum; // 自己还可购买的数量c + }; + if (it.prom_type == 6) { + let act_details = null; + let redis_num = 0; + let promcardbuynum = 0; + let qty = it.qty; - if (canBuyNum <= 0) { + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + store_id + "/" + it.prom_id, {}).then(res => { + + if (res.data.code == 0) { + + act_details = res.data.data; + + if (act_details.is_end == 1) { wx.showModal({ title: '提示', - content: '您已超出活动限购数量,无法支付,请取消订单!', + content: '活动已结束,无法支付,请取消订单!', showCancel: false, }); flag = false; return false; - }; - - if (limited > redis_num) { - if (canBuyNum <= redis_num) { - if (qty > canBuyNum) { - wx.showModal({ - title: '提示', - content: '您已超出活动限购数量,无法支付,请取消订单!', - showCancel: false, - }); - flag = false; - return false; - }; - - }; - - if (canBuyNum > redis_num) { - if (qty > redis_num) { - wx.showModal({ - title: '提示', - content: '活动库存不足,无法支付,请取消订单!', - showCancel: false, - }); - flag = false; - return false; - }; + } - }; - }; + if (act_details.id != it.prom_id) { + wx.showModal({ + title: '提示', + content: '活动发生了变化,无法支付,请取消订单,重新购买!', + showCancel: false, + }); + flag = false; + return false; + } - if (limited <= redis_num) { - if (qty > canBuyNum) { - wx.showModal({ - title: '提示', - content: '您已超出活动限购数量,无法支付,请取消订单!', - showCancel: false, - }); - flag = false; - return false; - }; - }; - }; + var t_now = ut.gettimestamp(); + if (act_details.is_end == 1 || act_details.start_time > t_now || act_details.end_time < t_now) { + wx.showModal({ + title: '提示', + content: '活动发生了变化,无法支付,请取消订单,重新购买!', + showCancel: false, + }); + flag = false; + return false; + } + } }); - }; - - }; + if(act_details.buy_limit>0 && flag){ + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { + data: { + store_id: store_id, + user_id: user_id, + card_id: it.card_id, + prom_type: it.prom_type, + prom_id: it.prom_id, + ispay:1 + } + }).then(res => { + if (res.data.code == 0) { + console.log('已经购买的数量:', res.data.data); + promcardbuynum = res.data.data.promcardbuynum; + } + }) + let limited = act_details.buy_limit; // 限购数量a + let canBuyNum = limited - promcardbuynum; // 自己还可购买的数量c + + if (canBuyNum < qty ) { + wx.showModal({ + title: '提示', + content: '您已超出活动限购数量,无法支付,请取消订单!', + showCancel: false, + }); + flag = false; + } + } + pt_act=act_details; - if(th.data.ser_paying) return false; - th.data.ser_paying=1; + } + } if (flag) { @@ -2855,12 +2904,28 @@ Page({ parentSn: order_sn, store_id: store_id }, function () { - th.data.ser_paying=0; - wx.showToast({ - title: '支付成功', - icon:'success', - duration: 2000 - }); + th.data.ser_paying=0; + wx.showToast({ + title: '支付成功', + icon:'success', + duration: 2000 + }); + + if(pt_act.kttype==1){ + + //--如果商家团的时候,这个要改,要用服务卡的接口--- + getApp().request.promisePost("/api/weshop/rechargeServicelist/vipAutoTuan", { + data: {orderSn:order_sn,storeId:os.stoid } + }) + } + + setTimeout(()=>{ + th.setData({is_get:0}) + th.onShow(); + },500) + + + }, function (e) { th.data.ser_paying=0; wx.showToast({ @@ -2891,7 +2956,9 @@ Page({ // }); // // } // }); - }; + }else { + th.data.ser_paying=0; + } }, @@ -2958,12 +3025,7 @@ Page({ }, }); - // let index = e.currentTarget.dataset.index; - // let cardList = self.data.cardList; - // cardList.splice(index, 1); - // self.setData({ - // cardList, - // }); + //self.request_list(self.data.currentRequestData); }, @@ -2994,7 +3056,7 @@ Page({ if (action == "buy") { - //--------------此时操作的数据------------ + //-------------- 此时操作的数据 ------------ var newd = { id: th.data.data.id, goods_num: th.data.goodsInputNum, diff --git a/pages/user/order_list/order_list.wxml b/pages/user/order_list/order_list.wxml index 93c921b..e504d79 100644 --- a/pages/user/order_list/order_list.wxml +++ b/pages/user/order_list/order_list.wxml @@ -322,19 +322,44 @@ 订单编号:{{item.order_sn}} - - 待支付 - 待评价 - - - 已评价 - - - 已取消 - - - 已作废 - + + + + 未支付 + 组团中 + + + + 待支付 + + + + 待支付尾款 + + + 待评价 + + + + + + 已评价 + + + + + + + 已取消 + + + + 已作废 + 支付尾款失败 + @@ -345,7 +370,8 @@ - + 秒杀 + 团购 @@ -389,7 +415,7 @@ 合计(改): - {{filters.toFix(item.account,2)}} + {{filters.toFix(item.account+item.pt_tail_money,2)}} @@ -407,18 +433,24 @@ 订单详情 - + 评价 评价 - 立即支付 - + 立即支付 + 立即支付 - + 支付尾款 + + + @@ -467,7 +499,7 @@ - +