diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js
new file mode 100644
index 0000000..3a227cc
--- /dev/null
+++ b/packageC/pages/presell/cart/cart2_pre.js
@@ -0,0 +1,832 @@
+var t = getApp(),app=t, a = t.request, ut = require("../../../../utils/util.js");
+var os=t.globalData.setting;
+var regeneratorRuntime = require('../../../../utils/runtime.js');
+var util_pay = require("../../../../utils/pay.js");
+
+Page({
+ data: {
+ url: t.globalData.setting.url,
+ resourceUrl: t.globalData.setting.resourceUrl,
+ imgUrl: t.globalData.setting.imghost,
+ goods: null,
+ order: null,
+ orderPrices: null,
+ coupons: null,
+ coupon: null,
+ invoiceToggle: !0,
+ payWithUserMoney: !0,
+ payWithPoints: !0,
+ maxWord: 0,
+ enterAddressPage: !1,
+ firstEnter: !0,
+ //页面获取的参数
+ param:null,
+ postdata:null,
+ //提交订单的格式
+ formData: {
+ order_amount:0,//支付金额
+ total_amount:0,//总价
+ all_price:0,//商品卖的总价
+ pay_points: 0,//使用积分
+ user_money: 0,//使用余额
+ couponCode: "",//使用优惠券(多单就用逗号隔开)
+ shipping_price:0,//物流费用
+ },
+
+ /*----------------立即购买---------------------*/
+ is_b_now:0, //0是购物车结算 1立即购买
+ bn_goods:null, //立即购买时候的调用商品
+ bn_use_money:0,//是否使用余额
+ bn_exp_type:1, //0是物流 1自提
+ bn_pick:0, //选择的门店
+ bn_pickname: "", //选择的门店名称
+ bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
+ /*------------------------*/
+ user_addr:null,//物流
+ userinfo:null, //获取会员
+ /*----------物流选择--------*/
+ wu_arr:null,
+ index:0,
+
+ //判断页面是返回回来的还是 首次进入的
+ isclose:1,
+ is_express:0,//选择物流的控制器
+ yuer:0,
+
+ },
+ onLoad: function(t) {
+ var th = this; this.setData({ is_b_now: 1});
+ th.data.postdata=getApp().get_b_now();
+ th.data.param=t;
+
+ },
+ onUnload: function () { this.setData({ isclose: 1 })},
+
+ //------获取会员信息-----先获取用户信息,在进行下一步---
+ get_info:function(func){
+ var user_id = t.globalData.user_id;
+ app.auth.get_u(func);
+ },
+
+ //-------------------获取物流---------------
+ get_wuliu(func) {
+ var th = this;
+ app.getwuliu(function (e) {
+ if (th.data.is_default_logistics) {
+ //如果第一个不是开启默认,说明要让用户自己选
+ if (!e[0].is_default) {
+ th.setData({ is_default_logistics: 0 });
+ }
+ }
+ th.setData({ wu_arr: e })
+ typeof func == "function" && func();
+ })
+ },
+
+ //------获取会员收货地址-----
+ getuser_addr:function(func){
+ if (app.globalData.baddr!=null){
+ var user_addr =app.globalData.baddr;
+ app.globalData.baddr=null;
+ func(user_addr);
+ }else{
+ a.get("/api/weshop/useraddress/page", {
+ data: { user_id:app.globalData.user_id, store_id: os.stoid, pageSize: 600 },
+ success: function (su) {
+
+ var user_addr = su.data.data.pageData;
+ var item = null;
+ var def_item=null;
+ for (var i = 0; i < user_addr.length; i++) {
+ if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }
+ if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }
+ }
+ if (item == null) item = def_item;
+ if (item == null) item = user_addr[0];
+ if (item == undefined) item = null;
+ func(item);
+ }
+ });
+ }
+ },
+ //----------------展示页面,是再获取用户信息之后--------------
+ show_page:function(){
+ var th=this;
+ var user=getApp().globalData.userInfo;
+ getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + user.user_id, {
+ data:{r:Math.random()},
+ success: function (e) {
+
+ getApp().globalData.userInfo = e.data.data;
+ th.setData({userinfo:e.data.data});
+ //获取立即购买的商品信息
+ th.get_buy_goods();
+
+ //获取提现金额
+ getApp().request.get("/api/weshop/withdrawals/summoney", {
+ data: { user_id:app.globalData.user_id, store_id: os.stoid, status: 0 },
+ success: function (su) {
+ if (su.data.code == 0) {
+ var yuer = parseFloat(th.data.userinfo.user_money -
+ (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);
+ if(yuer<0) yuer=0;
+ th.setData({ txmon: su.data.data.summoney, yuer: yuer });
+ }
+ }
+ });
+ }
+ });
+ },
+
+ //-----获取立即购买的商品信息----
+ get_buy_goods: async function () {
+ var th = this, a = getApp().request;
+ //定义变量
+ var gg = th.data.postdata,act = null,prelist = null;
+ var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id;
+ await getApp().request.promiseGet(url, {}).then(res => {
+ if (res.data.code == 0) {
+ act = res.data.data;
+ }
+ })
+ if (!act) {
+ wx.showToast({title: "未找到活动", icon: 'none', duration: 3000});
+ return false;
+ }
+ if (act.is_end==1 ) {
+ wx.showToast({title:'活动已经结束' , icon: 'none', duration: 3000});
+ return false;
+ }
+ if( ut.gettimestamp()>act.end_time){
+ wx.showToast({title:"活动定金支付时间已过期" , icon: 'none', duration: 3000});
+ return false;
+ }
+
+ var url = "/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + gg.presell_list_id;
+ await getApp().request.promiseGet(url, {}).then(res => {
+ if (res.data.code == 0) {
+ prelist = res.data.data;
+ }
+ })
+ if (!prelist) {
+ wx.showToast({title: "未找到商品", icon: 'none', duration: 3000});
+ return false;
+ }
+ //-- 调用商品 --
+ a.get("/api/weshop/goods/get/" + os.stoid + "/" + gg.goods_id, {
+ success: function (t) {
+ var gd = t.data.data;
+ if (!gd) return false;
+
+ t.data.data.original_img = os.imghost + t.data.data.original_img;
+ t.data.data['buynum'] = gg.goods_num;
+
+ var distr_t = 0, et = 0;
+ if (t.data.data.distr_type == 0) {
+ distr_t = gg.pick_dis;
+ } else {
+ distr_t = t.data.data.distr_type;
+ }
+
+ if(act.presell_type==1){
+ switch (distr_t) {
+ case 0:
+ et = 1;
+ //-- 系统后台有设置要默认的 --
+ if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;
+ break;
+ case 1:
+ et = 1;
+ break;
+ case 2:
+ et = 0;
+ break;
+ }
+ }else{
+ et=1; //要付定金的时候
+ }
+
+ t.data.data.shop_price = prelist.presell_money;
+ th.setData({
+ bn_goods: t.data.data, bn_pickname: gg.pick_name,prelist:prelist,act:act,
+ bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
+ });
+ //计算价格
+ th.calculatePrice2();
+ }
+ });
+ },
+
+ //----------子页返回父页触发----------
+ onShow: function () {
+ var th = this;
+ if (th.data.isclose == 0) {
+ wx.navigateTo({
+ url: "/pages/index/index/index"
+ })
+ } else {
+ this.getuser_addr(function (ie) {
+ //更换地址回来要重新调用计算价钱的接口
+ th.setData({ user_addr: ie });
+ if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
+ th.setData({ add_back: 1 });
+ if (this.data.bn_goods) th.calculatePrice2();
+ }
+ })
+ //--更新默认地址--,看一下是不是跳到地址页面
+ if (!getApp().globalData.is_cart_old) {
+ this.update_code();
+ } else {
+ getApp().globalData.is_cart_old = 0;
+ }
+ }
+
+
+ //先获取是否有关闭使用优惠券
+ getApp().getConfig2(function (ee) {
+ var json_d = JSON.parse(ee.switch_list);
+ th.data.json_d = json_d;
+ th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
+ var is_default_logistics = json_d.is_default_logistics;
+
+ th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });
+
+ var rank_switch = json_d.rank_switch;
+ var max_price = -1;
+ var show_card = null;
+ var name = "";
+ //如果有开等级卡的时候,
+ //因为都是调接口,要返回在计算
+ if (rank_switch == 2) {
+ //-- 获取所有的等级卡, --
+ getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
+ {}).then(res => {
+ if (res.data.code == 0) {
+ var plusCard = res.data.data;
+ //-- 循环判断,拿到最贵的那张卡 --
+ for (var ih in plusCard) {
+ if (plusCard[ih].IsStopBuy == true) { continue; }
+ if (max_price < 0) {
+ max_price = plusCard[ih].CardFee;
+ name = 'card' + plusCard[ih]['CorrPrice'];
+ show_card = plusCard[ih];
+ } else {
+ if (max_price < plusCard[ih].CardFee) {
+ max_price = plusCard[ih].CardFee;
+ name = 'card' + plusCard[ih]['CorrPrice'];
+ show_card = plusCard[ih];
+ }
+ }
+ }
+
+ if (show_card) {
+ name = name.toLowerCase();
+ th.setData({ card_name: name, show_card: show_card })
+ }
+ }
+ //-----先获取物流,再获取用户信息,再展示页面-----
+ th.get_wuliu(th.get_info(th.show_page));
+ })
+ } else {
+ //-----先获取物流,再获取用户信息,再展示页面-----
+ th.get_wuliu(th.get_info(th.show_page));
+ }
+ }, 1)
+
+ },
+ //---------------检查是否有收货地址-------------------
+ checkAddressList: function() {
+ var t = this;
+ return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
+ title: "请先填写或选择收货地址~",
+ success: function(a) {
+ a.confirm ? t.enterAddressPage() : wx.navigateBack();
+ },
+ fail: function() {
+ wx.navigateBack();
+ }
+ }), !1);
+ },
+ showInvoice: function() {
+ this.setData({
+ invoiceToggle: !this.data.invoiceToggle
+ });
+ },
+ keyUpChangePay1: function(t) {
+ this.setData({
+ payWithUserMoney: !(t.detail.value.length > 0)
+ });
+ },
+ keyUpChangePay2: function(t) {
+ this.setData({
+ payWithPoints: !(t.detail.value.length > 0)
+ });
+ },
+ keyUpChangeNum: function(t) {
+ this.setData({
+ maxWord: t.detail.value.length
+ });
+ },
+ //---------计算立即购买----------
+ calculatePrice2: function () {
+ console.log('calculatePrice2');
+ var th = this, good = this.data.bn_goods;
+ //-----------计算商品总价--------------
+ var allpice = good.shop_price * good.buynum;
+ allpice=parseFloat(allpice).toFixed(2);
+ var txt = "formData.all_price";
+ th.setData({ [txt]: allpice, });
+ console.log(th.data.formData);
+
+ app.getConfig2(function (ee) {
+ app.getwuliuprice(function (rs) {
+ var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
+ //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
+ if (th.data.user_addr != null && th.data.bn_exp_type == 0
+ && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){
+ switch (good['exp_sum_type']) {
+ case 1:
+ //统一运费
+ o_shipping_price += good['uniform_exp_sum']; break;
+ case 2:
+ if (goods_weight < 0) goods_weight = 0;
+ //累积商品重量 每种商品的重量 * 数量
+ goods_weight += good['weight'] * good['buynum'];break;
+ case 3:
+ if (goods_piece < 0) goods_piece = 0;
+ //累积商品数量
+ goods_piece += good['buynum']; break;
+ }
+
+ var code = th.data.wu_arr[th.data.index].code;
+ var freight_free = ee.freight_free; //全场满多少包邮
+ var shipping_price=
+ th.calculatewuliu(code, o_shipping_price, goods_weight,
+ goods_piece, th.data.user_addr, freight_free, allpice, rs);
+
+ shipping_price = parseFloat(shipping_price).toFixed(2);
+ var wl_txt = "formData.shipping_price";
+ th.setData({ [wl_txt]: shipping_price, })
+
+ }else{
+ var wl_txt = "formData.shipping_price";
+ th.setData({ [wl_txt]: 0, })
+ }
+ //-----------------总价-----------------
+ var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price);
+ total_m = parseFloat(total_m).toFixed(2);
+
+ var atxt= "formData.total_amount";
+ th.setData({ [atxt]: total_m, })
+ var order_m = total_m;
+
+ var txt = "formData.user_money";
+ var txt2 = "formData.order_amount";
+ //--------------如果使用余额---------------------
+ if (th.data.bn_use_money == 1 && th.data.yuer>0) {
+ if ( parseFloat(th.data.yuer) > total_m) {
+ th.setData({ [txt]: total_m, [txt2]:0 })
+ }else{
+ order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
+ order_m = order_m.toFixed(2);
+ th.setData({ [txt]: th.data.yuer, [txt2]: order_m })
+ }
+ }else{
+ th.setData({ [txt]: 0, [txt2]: order_m })
+ }
+
+ });
+ });
+ },
+ //--------------------提交订单-----------------------
+ submitForm: async function(t){
+ if(this.data.is_summit_ing==1) return false; //--提交中退出--
+ this.data.is_summit_ing=1;
+
+ var th=this,pdata=new Array();
+ var ff=true;
+ //------------立即购买-------------
+
+ //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候
+ if(th.data.bn_exp_type == 0 && th.data.user_addr==null && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){
+ ff = false;
+ getApp().my_warnning("请选择收货地址",0,this);
+ this.data.is_summit_ing = 0;
+ }
+ if (!ff) return false;
+ var addr = th.data.user_addr;
+ if (th.data.bn_exp_type == 1) addr=null;
+
+ if(th.data.bn_exp_type==0 && (th.data.kt_type!=3)) {
+ if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
+ getApp().my_warnning("读取物流失败",0,this);
+ this.data.is_summit_ing = 0;
+ return false;
+ }
+ }
+
+ //阶梯团强制带1,自提~~~
+ if(th.data.kt_type==3 ){
+ th.data.bn_exp_type=1;
+ }
+
+ var item={
+ 'user_id':app.globalData.user_id,
+ 'consignee': addr == null ? "" : addr.consignee,
+ 'province': addr == null ? 0 : addr.province,
+ 'city': addr == null ? 0 : addr.city,
+ 'district': addr == null ? 0 : addr.district,
+ 'twon': addr == null ? 0 : addr.twon,
+ 'address': addr == null ? "": addr.address,
+ 'more_address': addr == null ? "" : addr.more_address,
+ 'mobile': addr == null ? th.data.userinfo.mobile:addr.mobile,
+ 'email':'',
+ 'invoice_title':'',
+ 'goods_price': th.data.formData.all_price, //商品总价
+ 'shipping_price': th.data.formData.shipping_price, //物流金额
+ 'user_money': th.data.formData.user_money, //使用余额
+ 'total_amount': th.data.formData.total_amount, //订单总价
+ 'order_amount': th.data.formData.order_amount, //应付
+ 'user_note': t.detail.value.user_note, //用户备注
+ 'store_id':os.stoid, //商家
+ 'pickup_id': th.data.bn_pick, //门店
+ 'prom_type':th.data.bn_goods.prom_type, //促销活动类型
+ 'prom_id': th.data.bn_goods.prom_id, //促销活动id
+ 'order_goods':new Array(),
+ };
+
+ //老会员成为分销下线需要的参数
+ if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){
+ //判断一下分享人是不是分享商
+ await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{
+ if(res.data.code==0){
+ var user= res.data.data;
+ if(user.is_distribut==1){
+ item.first_leader=parseInt(getApp().globalData.first_leader);
+ }
+ }
+ })
+ }
+
+ if(th.data.qh!='')
+ {
+ item.team_qh=th.data.qh;
+ item.pt_listno=th.data.qh;
+ }
+
+ var gg =app.get_b_now();
+ var goods={
+ 'goods_id': gg.goods_id,
+ 'goods_name': gg.goods_name,
+ 'goods_sn': gg.goods_sn,
+ 'goods_num': gg.goods_num,
+ 'market_price': th.data.bn_goods.market_price,
+ 'goods_price': th.data.bn_goods.shop_price,
+ 'member_goods_price': th.data.bn_goods.shop_price,
+ 'store_id': os.stoid,
+ 'prom_type':th.data.bn_goods.prom_type, //促销活动类型
+ 'prom_id': th.data.bn_goods.prom_id, //促销活动id
+ };
+
+ //--导购分享过来的id--
+ if(gg.guide_id){
+ goods.guide_id=gg.guide_id;
+ goods.guide_type=gg.guide_type;
+ //调用接口判断是不是会员
+ await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+os.stoid+"/"+gg.guide_id,{}).then(res=>{
+ if(res.data.code==0){
+ goods.guide_name=res.data.data.salesman;
+ goods.guide_sn=res.data.data.salesman_no;
+ }
+ })
+ }
+
+ //--商品的房间号--
+ if(gg.room_id && gg.room_id>0){
+ item.room_ids=gg.room_id;
+ goods.room_id=gg.room_id;
+ }
+
+ if(th.data.bn_goods.is_normal){goods.is_pd_normal=1;}
+
+ item.order_goods.push(goods);
+ pdata.push(item);
+
+ if (pdata.length==0) return;
+ var str = JSON.stringify(pdata);
+ wx.showLoading({title: "加载中"});
+ wx.request({
+ url: os.url + '/api/weshop/order/createWxdOrder',
+ data: str,
+ method: 'POST',
+ header: {
+ 'content-type': 'application/json'
+ },// 设置请求的 header
+ success: function (res) {
+
+ wx.hideLoading();
+ if (res.statusCode == 200) {
+ var data=res.data;
+ if(data.code==0){
+ console.log(th.data.is_b_now);
+ //如果是购物车结算,还要删除购物车
+ if (th.data.is_b_now == 0) {
+ console.log(th.data.cartlist_y);
+ var list = th.data.cartlist_y;
+ for (var i = 0; i < list.length; i++) {
+ //删除购物车
+ getApp().request.delete("/api/weshop/cart/del/" + os.stoid + "/" + list[i].id, {});
+ }
+ }
+ var order_amount = 0;
+ pdata.forEach(function (em, ind) {
+ order_amount += em.order_amount;
+ })
+ //要进行判断,如果是用微信支付,就要跳转到支付界面
+ if (order_amount > 0) {
+ th.setData({ isclose: 0 });
+ //void e.jumpToCart4({
+ // order_sn: data.data,
+ // type:1,
+ // }, 1);
+ util_pay.pay(data.data, function() {
+ setTimeout(function () {
+ wx.reLaunch({
+ //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,
+ url: "/pages/team/team_success/team_success?ordersn=" + data.data,
+ })
+ },1000)
+ }, function () {
+ //支付失败
+ setTimeout(function () {
+ //wx.navigateBack({ delta: 1 })
+ wx.reLaunch({
+ url: "/pages/user/order_list/order_list",
+ })
+ },1000)
+
+ },os.stoid,1);
+
+ } else {
+ var dd = {
+ parent_sn: data.data,
+ store_id: os.stoid,
+ type: 1,
+ };
+ //return false;
+ getApp().request.post("/api/weshop/order/pay/createOrder", {
+ data: dd,
+ success: function (t) {
+ console.log(t);
+ app.my_warnning("支付成功",1,th);
+ setTimeout(function () {
+ th.setData({ isclose: 0 });
+
+ if(th.data.is_normal==1){
+ /*--
+ wx.navigateTo({
+ url: "/pages/user/order_list/order_list",
+ })--*/
+ var url="/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data;
+ wx.reLaunch({
+ url: url
+ })
+
+ }else{
+ wx.reLaunch({
+ url: "/pages/team/team_success/team_success?ordersn=" + data.data,
+ })
+ }
+
+ }, 1000)
+ }
+ });
+ }
+ }
+ else{
+ th.data.is_summit_ing=0; //是否提交中
+ getApp().confirmBox(data.msg);
+ }
+ } else {
+ th.data.is_summit_ing=0; //是否提交中
+ console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
+ }
+ },
+ fail: function () {
+ th.data.is_summit_ing=0; //是否提交中
+ wx.hideLoading();
+ console.log("index.js wx.request CheckCallUser fail");
+ },
+ complete: function () {}
+ })
+ },
+ useCoupon: function() {
+ if (this.data.order.couponNum <= 0) {
+ //return t.showWarning("无可用优惠券");
+ getApp().my_warnning("无可用优惠券",0,this);
+ return;
+ }
+ var a = {
+ lid: this.data.coupon ? this.data.coupon.id : "0"
+ };
+ wx.navigateTo({
+ url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)
+ });
+ },
+ enterAddressPage: function() {
+ getApp().globalData.is_cart_old=1;
+ this.data.enterAddressPage = !0, wx.navigateTo({
+ url: "/pages/user/address_list/address_list"
+ });
+ },
+
+ //--------立即购买时,选择自提和物流-----------
+ setexptype_w:function(t){
+ var th=this;
+ var ty = t.currentTarget.dataset.t,txt = t.currentTarget.dataset.txt;
+ th.setData({ [txt]: ty });
+ var iszt=1;
+ if(ty==0){
+ th.setData({ is_all_zt: 0 });
+ }else{
+ for(var i=0;i
0 && o_price > freight_free){ return 0;}
+ if (user_addr==null) { return 0; }
+ //计算物流的config item;
+ var item=null;
+ //先根据 镇 县 区找计算的config
+ item = th.get_wuliu_config(user_addr.district,code,rs);
+ if (item==null) item = th.get_wuliu_config(user_addr.city, code, rs);
+ if (item==null) item = th.get_wuliu_config(user_addr.province, code, rs);
+ if (item == null) item = th.get_wuliu_default(code,rs);
+ if (item == null) return o_shipping_price;
+ var fw_price = 0, fp_price=0;
+ item=item.config;
+ if (item == null) return o_shipping_price;
+ //------按重量----------
+ if (goods_weight>0) {
+ fw_price =parseFloat(item['money']);
+ if (goods_weight > item['first_weight']){
+ var fw = goods_weight - item['first_weight'];
+ var n = Math.ceil(fw/item['second_weight'])
+ fw_price = fw_price + n * parseFloat(item['add_money']);
+ }
+ }
+ //------按件数----------
+ if (goods_piece > 0) {
+ fp_price = parseFloat(item['piecemoney']);
+ if (goods_piece > item['first_piece']) {
+ var fp = goods_piece - item['first_piece'];
+ var m = Math.ceil(fp / item['second_piece'])
+ fp_price = fp_price + m * parseFloat(item['add_piecemoney']);
+ }
+ }
+ var rspice =parseFloat(price + fw_price + fp_price);
+ return rspice;
+ },
+
+ //------------循环获取config-----------
+ get_wuliu_config:function(region_id,code,rs){
+ var item=null,rslist = rs.pageData;
+ for (var i = 0; i < rslist.length;i++){
+ if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];}
+ }
+ return item;
+ },
+ //-------循环获取config,code default-------
+ get_wuliu_default: function (code, rs) {
+ var item = null, rslist=rs.pageData;
+ for (var i = 0; i < rslist.length; i++) {
+ if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }
+ }
+ return item;
+ },
+
+ //----------立即购买,选择物流-------------
+ bindPickerChange:function(e){
+ var ind = e.detail.value
+ this.setData({ index: ind });
+ this.calculatePrice2();
+ },
+
+ //----------购物车结算,选择物流-------------
+ bindPickerChange_w: function (e) {
+ var ind=e.detail.value, txt = e.currentTarget.dataset.txt;
+ this.setData({ [txt]: ind });
+ this.calculatePrice();
+ },
+
+ cart_set_err: function (e) {
+ var txt = e.currentTarget.dataset.err;
+ var ob = {};
+ ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";
+ this.setData(ob);
+ },
+
+ //// 开启物流的弹窗
+ show_wu_arr:function(e){
+ this.setData({ open_express: 1});
+ },
+
+ //更新下默认,在onshow里面
+ update_code(){
+ var th=this,m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;
+
+ var uii=setInterval(function () {
+ if(th.data.wu_arr){
+ clearInterval(uii);
+ for (var k = 0; k < th.data.wu_arr.length; k++) {
+ var item = th.data.wu_arr[k];
+ if (def_exp_code == item.code) {
+ m_wind = k;
+ }
+ }
+ //--如果是立即购买--
+ th.setData({ index: m_wind, is_express: m_wind});
+ }
+ },500)
+ },
+
+ // 关闭物流的弹窗
+ close_express:function(){
+ this.setData({ open_express:0 });
+ },
+ // 选择物流
+ click_express_name:function(e){
+ var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
+ var index=e.currentTarget.dataset.idxe;
+ var ob={ is_express: index, is_shipping_code: shippingcode,index:index};
+ this.setData(ob);
+ },
+
+ //点击确定物流
+ determine_expres:function(e){
+ this.setData({ open_express: 0});
+ this.calculatePrice2();
+ },
+ //设置默认物流
+ select_default_logistics: function () {
+ var th=this;
+ var is_shipping_code=this.data.is_shipping_code
+ getApp().request.put("/api/weshop/users/update",{
+ data: { user_id: getApp().globalData.user_id, store_id: os.stoid, def_exp_code: is_shipping_code},
+ success:function(rse){
+ if (rse.data.code==0){
+ getApp().globalData.userInfo.def_exp_code=is_shipping_code;
+ th.setData({ open_express: 0 });
+ //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19----
+ //if(th.data.is_b_now==1) th.calculatePrice2();
+ //else th.calculatePrice();
+ th.calculatePrice2();
+ }
+ }
+ })
+ },
+
+
+ //跳转到购买卡
+ buycard:function(){
+ getApp().goto("/pages/user/plus/plus");
+ getApp().globalData.plus_buy_back=1;
+ }
+});
diff --git a/packageC/pages/presell/cart/cart2_pre.json b/packageC/pages/presell/cart/cart2_pre.json
new file mode 100644
index 0000000..0cfb931
--- /dev/null
+++ b/packageC/pages/presell/cart/cart2_pre.json
@@ -0,0 +1,7 @@
+{
+ "navigationBarTitleText": "填写订单",
+ "enablePullDownRefresh": false,
+ "usingComponents": {
+ "warn": "/components/long_warn/long_warn"
+ }
+}
\ No newline at end of file
diff --git a/packageC/pages/presell/cart/cart2_pre.wxml b/packageC/pages/presell/cart/cart2_pre.wxml
new file mode 100644
index 0000000..ba5358c
--- /dev/null
+++ b/packageC/pages/presell/cart/cart2_pre.wxml
@@ -0,0 +1,209 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packageC/pages/presell/cart/cart2_pre.wxss b/packageC/pages/presell/cart/cart2_pre.wxss
new file mode 100644
index 0000000..686099e
--- /dev/null
+++ b/packageC/pages/presell/cart/cart2_pre.wxss
@@ -0,0 +1,983 @@
+.bdr_t-14 {
+ border-top-left-radius: 14rpx;
+ border-top-right-radius: 14rpx;
+}
+.bdr_b-14 {
+ border-bottom-left-radius: 14rpx;
+ border-bottom-right-radius: 14rpx;
+}
+.bdr14 {
+ border-radius: 14rpx;
+}
+.mgt20 {
+ margin-top: 20rpx;
+}
+.shadow {
+ box-shadow: 0 4rpx 12px #e7e9eb;
+}
+.shadow-1 {
+ box-shadow: 16rpx 0px 12px #e7e9eb;
+}
+
+
+page {
+ /* background-color: #FAFAFA; */
+ background-color: #F0F0F0;
+ padding: 0 22rpx;
+ box-sizing: border-box;
+}
+.container {
+ background-color: #F0F0F0;
+ /* padding-top: 28rpx; */
+ padding-bottom: 120rpx;
+}
+.user-mes {
+ position: relative;
+ background-color: #fff;
+ font-size: 32rpx;
+ color: #444;
+ /* margin-top: 28rpx; */
+ border-radius: 14rpx;
+}
+.user-contact {
+ padding: 24rpx 26rpx;
+ font-weight: 600;
+}
+
+.location {
+ position: relative;
+ padding: 0 70rpx 24rpx;
+}
+
+.pos-icon {
+ position: absolute;
+ left: 28rpx;
+ top: 6rpx;
+ width: 30rpx;
+ height: 36rpx;
+}
+
+.border-img {
+ width: 100%;
+ height: 12rpx;
+}
+
+.update-logistics {
+ position: absolute;
+ right: 0;
+ top: 0;
+ width: 80rpx;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.arrow-rigth {
+ width: 32rpx;
+ height: 32rpx;
+}
+
+.order-meg {
+ margin-bottom: 20rpx;
+ font-size: 28rpx;
+
+}
+
+.order-detail {
+ padding: 30rpx 0;
+ border-bottom: 2rpx solid #eee;
+ color: #777;
+ min-height: 190rpx;
+ background-color: #fff;
+
+}
+
+.goods-img {
+ float: left;
+ width: 200rpx;
+ height: 200rpx;
+ margin: 0 20rpx;
+}
+
+.order-cont {
+ float: left;
+ width: 438rpx;
+}
+
+.goods-name {
+ height: 74rpx;
+ line-height: 40rpx;
+ overflow: hidden;
+ margin-bottom: 16rpx;
+ font-size: 28rpx;
+ color: #333;
+
+}
+
+.goods-color {
+ font-size: 24rpx;
+}
+
+.order-num {
+ margin-top: 25rpx;
+ font-size: 24rpx;
+ line-height: 42rpx;
+}
+
+.set-mes{
+ background-color: #fff;
+ /* margin-top: 20rpx; */
+}
+.use-item{
+ display: flex;
+ align-items: center;
+ height: 80rpx;
+ /* border-bottom: 1px solid #ddd; */
+ font-size: 30rpx;
+ /* width:95%;
+margin:auto; */
+ padding: 0 26rpx;
+}
+.use-item>view{
+ display: flex;
+ /* margin-right: 12rpx; */
+}
+.use-item.bfff{
+ background-color: #fff;
+}
+.use-item .dp{
+ display: block;
+ width: 50rpx;
+ height: 50rpx;
+ margin-left: -6rpx;
+}
+
+.set-item {
+ justify-content: space-between;
+ background-color: #fff;
+}
+
+.set-btn {
+ display: flex;
+ font-size: 24rpx;
+}
+
+.set-mes input {
+ width: 380rpx;
+ height: 50rpx;
+ line-height: 50rpx;
+ border: 1px solid #ddd;
+}
+
+.use-btn {
+ width: 100rpx;
+ height: 50rpx;
+ margin-left: 20rpx;
+ line-height: 50rpx;
+ text-align: center;
+ background-color: #f23030;
+ color: #fff;
+}
+
+.coupon-mes {
+ /* box-sizing: border-box; */
+ height:95rpx;
+ padding: 0 26rpx;
+ background-color: #fff;
+ font-size: 30rpx;
+ color: #444;
+ /* width: 100%; */
+ border-radius: 14rpx;
+ margin-top: 20rpx;
+ margin-bottom: 20rpx;
+}
+
+.coupon-title {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ height: 92rpx;
+}
+
+.coupon-title>view {
+ display: flex;
+}
+
+.coupon-num {
+ height: 36rpx;
+ margin-left: 20rpx;
+ padding: 0 16rpx;
+ line-height: 36rpx;
+ text-align: center;
+ background-color: #f23030;
+ color: #fff;
+ font-size: 24rpx;
+}
+
+.leave-word {
+ position: relative;
+ font-size: 24rpx;
+ margin-left: 20rpx;
+ flex-grow: 1;
+}
+
+.word-box {
+ font-size: 26rpx;
+ /* width: 600rpx; */
+ padding: 10rpx;
+ height: 28rpx;
+ line-height: 40rpx;
+}
+
+.max-word {
+ position: absolute;
+ right: 0;
+ bottom: 0;
+}
+
+.information {
+ padding: 0 26rpx;
+ background-color: #fff;
+ /* margin-bottom: 120rpx; */
+}
+
+.information .item {
+ display: flex;
+ justify-content: space-between;
+ height: 60rpx;
+ line-height: 60rpx;
+ font-size: 26rpx;
+ color: #777;
+}
+
+.btn-wrap {
+ height: 94rpx;
+ box-sizing: border-box;
+ display: flex;
+ justify-content: space-between;
+ background-color: white;
+ align-items: center;
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ padding: 0 30rpx;
+}
+
+.tips-btn {
+ /* float: right;
+ width: 200rpx;
+ height: 100rpx;
+ line-height: 100rpx;
+ text-align: center;
+ font-size: 30rpx;
+ color: #fff;
+ background-color: #f23030; */
+ color: white;
+ background-color: #FE4445;
+ height: 72rpx;
+ line-height: 72rpx;
+ padding: 0 42rpx;
+ border-radius: 36rpx;
+ margin-left: 0;
+ margin-right: 0;
+}
+
+.pay-amount {
+ /* float: right;
+ display: flex;
+ align-items: center;
+ height: 100rpx;
+ font-size: 26rpx;
+ margin-right: 40rpx; */
+}
+
+.payable {
+ color: #444;
+ /* margin-right: 20rpx; */
+}
+
+.shipping-modal {
+ z-index: 20;
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ overflow-y: hidden;
+ color: #666666;
+ background-color: white;
+}
+
+.shipping-nav {
+ text-align: center;
+ font-size: 35rpx;
+ padding-top: 30rpx;
+}
+
+.shipping-list {
+ padding: 20rpx 30rpx 40rpx;
+ font-size: 28rpx;
+}
+
+.shipping-item {
+ display: block;
+ padding: 20rpx 0;
+}
+
+.shipping-btn {
+ width: 100%;
+ color: white;
+ background-color: #f23030;
+ line-height: 90rpx;
+ text-align: center;
+ font-size: 40rpx;
+}
+
+/*----------nyf新增,地址---------*/
+.add_new{
+ height: 90rpx;
+ display: flex;
+ align-items: center;
+ padding: 0 26rpx;
+}
+.addr_jia{width: 45rpx; height: 45rpx; border: 1rpx solid #ddd;
+ margin-right: 15rpx;vertical-align: middle;}
+.yu_er{
+ margin-left: 10rpx;
+ /* margin-right: 60rpx; */
+}
+.wuliu{margin-left: 20rpx;}
+
+
+/*---- 优惠券列表 -----*/
+.xc-coupon-frame{
+ width: 100%;
+ height: 92rpx;
+
+}
+.xc-coupon-frame .work-frame{
+ width: 100%;
+ height: 100%;
+ border-bottom:3rpx solid #eee;
+ padding: 0 26rpx;
+ background-color: white;
+}
+.xc-right{
+ width:20rpx;
+ height:20rpx;
+ border-top:2rpx solid #000;
+ border-right:2rpx solid #000;
+ transform:rotate(45deg);
+ display:inline-block;
+}
+
+.xc-coupon-frame .work-frame .work{ font-size: 30rpx; line-height: 92rpx; }
+.xc-right-frame{font-size: 30rpx;line-height: 92rpx; margin-right: 10rpx }
+
+/* 自定义弹出窗口 */
+.cx-popup{
+ width:100%;
+ height:880rpx;
+ background: #fff;
+ z-index: 35;
+ border-top-left-radius: 20rpx;
+ border-top-right-radius: 20rpx;
+ position:fixed;
+ bottom:0;
+ left: 0;
+ /* padding-bottom: 25rpx; */
+}
+
+.cx-popup .top{
+ width:95%;
+ height:100rpx;
+ border-bottom:3rpx solid #ddd;
+ margin: auto;
+ margin-top: 30rpx;
+
+}
+.xc-top-content{
+ width: 93%;
+ height:85rpx;
+ padding-top: 30rpx;
+ font-size: 34rpx;
+ font-weight: 600;
+
+}
+
+
+.xc-valid-coupon{
+ width: 90%;
+ height:40rpx;
+ padding-top: 24rpx;
+ overflow: hidden;
+}
+.xc-frame{
+ width: 100%;
+ height:60%;
+}
+
+.xc-frame .list-frame{
+ width: 95%;
+ height: 100%;
+ overflow-y:scroll;
+
+}
+.xc-close-frame{
+ margin-top:-10rpx;
+
+}
+
+.xc-close{
+ width: 37rpx;
+height: 37rpx;
+border-radius: 50%;
+border: 3rpx solid #333;
+text-align: center;
+line-height: 34rpx;
+font-size: 29rpx;
+color: #333;
+
+}
+.xc-money{
+ color: #af2346;
+ font-size: 35rpx;
+}
+
+.xc-money-frame{
+ margin-left:35rpx;
+
+}
+.xc-coupon-effect{
+ width: 99%;
+ min-height: 100rpx;
+ border-bottom:3rpx solid #ddd;
+
+
+}
+.xc-goods-coupon{
+ width: 85%;
+ height:100%;
+
+}
+.xc-title{
+ width:50%;
+ margin-left:222rpx;
+
+}
+.xc-coupon-money0{
+ color: #c91e31;
+ font-size: 35rpx;
+ line-height: 40rpx;
+
+}
+.xc-coupon-money{
+ color: #c91e31;
+ font-size: 35rpx;
+ line-height: 40rpx;
+ padding-top: 10px;
+
+}
+.xc-coupon-money1{
+ color: #444;
+ font-size: 28rpx;
+ line-height: 60rpx;
+
+
+}
+.xc-coupon-time{
+ height: 50rpx;
+ font-size: 27rpx;
+ color: #a4a4a4;
+}
+.xc-coupon-time .time{
+ margin-left: 15rpx;
+ font-size: 27rpx;
+}
+.xc-coupon-selection{
+ height:100%;
+}
+
+.xc-confirm {
+ width: 50%;
+ border-radius: 50rpx;
+ height: 80rpx;
+ margin:0 auto;
+ background:#d60021;
+ color:#fff;
+ font-size:28rpx;
+ margin-top: 28rpx;
+}
+
+.up{ animation: up .7s; }
+.down{ animation: down 1s; }
+@keyframes up { 0% { transform: translateY(550rpx); } 100% { transform: translateY(0); } }
+@keyframes down { 0% { transform: translateY(0); } 100% { transform: translateY(550rpx); } }
+
+.xc-not-Selection{
+ width: 40rpx;
+height: 40rpx;
+ background: #eeeeee;
+}
+
+
+.xc-close-express{
+ width: 40rpx;
+height: 40rpx;
+border-radius: 50%;
+border: 3rpx solid #333;
+text-align: center;
+font-size:32rpx;
+line-height: 38rpx;
+color: #333;
+margin-top: 5rpx;
+}
+.cx-popup .tops{
+ width: 100%;
+height: 145rpx;
+border-bottom: 3rpx solid #eee;
+
+}
+.top-content {
+ width: 82%;
+padding-top: 33px;
+height: 100%;
+padding-left: 40rpx;
+}
+.close-frame{
+ margin-top: 30rpx;
+
+}
+
+.xc-hook {
+width: 33rpx;
+height: 33rpx;
+transform: rotate(-135deg);
+line-height: 35rpx;
+text-align: center;
+margin-right: 20rpx
+
+
+}
+.xc-hooks {
+width: 30rpx;
+height: 30rpx;
+border: 1rpx solid #999;
+margin-right: 20rpx;
+}
+.express_list_frame{
+ display: flex;
+height: 80rpx;
+align-items: center;
+padding-left: 40rpx;
+border-bottom: 1rpx solid #eee;
+
+}
+.express_list{
+ width: 100%;
+ height: 65%;
+ overflow-y: auto;
+ margin-bottom: 40rpx;
+
+}
+.xc-confirms {
+ box-sizing: border-box;
+ width: 40%;
+ border-radius: 50rpx;
+ height: 80rpx;
+ margin:0 auto;
+ font-size:28rpx;
+ background: #fff;
+ color: #333;
+ border: 2rpx solid #333;
+}
+
+
+/* 优惠券的改版样式 */
+.xc-coupon-frame{
+ /* width: 710rpx; */
+ width: 100%;
+ height:auto;
+ margin: 0 auto;
+
+}
+.xc-coupon-frame .coupon-frame{
+ width: 100%;
+ height: 200rpx;
+ margin-top:10rpx;
+ border-bottom: 1rpx solid #eee;
+
+}
+.xc-coupon-frame .coupon-frame .coupon-left{
+ width: 215rpx;
+ height:100%;
+ overflow: hidden;
+}
+.xc-money-frames{
+ width:96%;
+ margin-top: -10px;
+}
+
+.xc-rmb-symbol{
+ font-size:40rpx;
+
+}
+
+.xc-rmb-val{
+ font-size:60rpx;
+
+}
+.coupon-explain{
+ font-size:25rpx;
+width:100%;
+
+
+}
+.xc-valuer{
+ margin-top:39rpx;
+ margin-left:28rpx;
+ font-size:25rpx;
+}
+.coupon-frame .oval{
+ width:155rpx;
+ height:83rpx;
+ border-radius: 50%;
+ right:-78rpx;
+ top:-37rpx;
+}
+.coupon-right{
+ /* width:490rpx; */
+ height: 99%;
+ border-top: 1rpx solid #eaeaea;
+ /* //border-bottom: 1rpx solid #eaeaea; */
+ border-right: 1rpx solid #eaeaea;
+ flex-grow: 1;
+}
+.coupon-annotation{
+ width: 95%;
+ height: 100%;
+
+}
+.xc-brand{
+ width:100rpx;
+ height:35rpx;
+ line-height: 35rpx;
+ font-size:21rpx;
+ border-radius:10rpx; position: relative; top:-1px;
+ margin-right: 8rpx
+}
+.top-frame{
+ width:82%;
+ height: 75rpx;
+ margin-top:10rpx;
+}
+.top-frame .coupon-wode{
+ font-size: 25rpx;
+ margin-left:10rpx;
+ width:340rpx;
+ height:88rpx;
+}
+.coupon-code{
+ width:60rpx;
+ height:60rpx;
+ margin-top:5rpx;
+
+}
+.frame{
+ width: 100%
+}
+.coupon-time{
+ font-size: 23rpx;
+ line-height:33rpx;
+ color: #333;
+}
+
+.clik-get{
+ width:125rpx;
+ height:45rpx;
+ border-radius: 25rpx;
+ line-height: 45rpx;
+ font-size:25rpx;
+ bottom:67rpx;
+ right:6px;
+}
+
+.code-img{
+ margin-left:20rpx;
+}
+.bottmo-explain{
+top:145rpx;
+width:94%;
+border-top:1rpx dashed #eee;
+padding-top:8rpx;
+height:38rpx;
+line-height: 51rpx;
+
+}
+.font-word{
+ font-size: 22rpx;
+}
+.circle-size{
+ background: #a0a0a0;
+ width: 27rpx;
+ height: 27rpx;
+ margin-top:13rpx;
+margin-left:8rpx;
+display: flex;
+
+align-items: center;
+}
+.xc-jiantou{
+ /* width: 9rpx;
+ height: 9rpx; */
+ /* border-top: 2rpx solid #fff;
+ border-right: 2rpx solid #fff; */
+ transform: rotate(-90deg);
+ color: #fff;
+ font-size: 15rpx;
+ /* display:inline-block;
+ margin-top: 6.5rpx; */
+ text-align: center;
+width: 24rpx;
+}
+.xc-buttom{
+ box-sizing: border-box;
+ width:100%;
+ min-height:76rpx;
+ height:auto;
+ line-height:40rpx;
+ border-left:1rpx solid #eee;
+ border-right:1rpx solid #eee;
+ border-bottom:1rpx solid #eee;
+/* margin-left: 6rpx; */
+}
+
+.goods-num{
+ font-size: 28rpx;
+ color: #333;
+}
+
+.explain-coupon{
+ font-size:25rpx;
+ padding: 10rpx 10rpx
+}
+.circle-frame{
+ width: 20rpx;
+ height: auto;
+ z-index:1;
+ left:210rpx;
+
+}
+.circle-sawtooth{
+ width: 11rpx;
+ height: 11rpx;
+ background: #fff;
+}
+
+.red{background-color: #fe7496;}
+.green{ background-color: #22c7c1;}
+.blue{background-color:#5e82e3;}
+.g_gray{background-color: #aaaaaa}
+
+.f_text{text-align: center; height:96rpx; }
+.xc-hook.sn {
+ margin-top:12%;
+width:45rpx;
+height:45rpx;
+font-size:28rpx;
+line-height:44rpx;
+
+
+}
+.xc-hooks.on{
+ margin-top:12%;
+width:42rpx;
+height:42rpx;
+}
+.may_use_coupon{
+ /* width: 95%; */
+ /* height: 68rpx; */
+ line-height:78rpx;
+ padding: 0 26rpx;
+ justify-content: space-between;
+ align-items: center;
+}
+.determine-frame{
+ width: 100%;
+ height: 130rpx;
+
+}
+.xc-determine{
+ height: 80rpx;
+ width: 40%;
+ border-radius: 50rpx;
+background: #d60021;
+color: #fff;
+font-size: 28rpx;
+margin: 0 auto;
+
+}
+.click-buttem{
+width: 90%;
+margin: auto;
+}
+.logistics-name{
+ margin-right:20rpx;
+}
+.xc-border{
+ border-top:8rpx solid #eee;
+width: 100%
+}
+.main-top{
+margin-top: 20rpx;
+
+}
+.xc-hookts{
+border: 1rpx solid #999;
+
+}
+.xc-hookts.on{
+ width:30rpx;
+height:30rpx;
+
+}
+.xc-hookt.sn{
+ width: 32rpx;
+height: 32rpx;
+font-size: 28rpx;
+line-height: 34rpx;
+}
+.xc-hookt{
+ transform: rotate(-135deg);
+text-align: center;
+
+}
+.main-bottom{
+ margin-bottom: 20rpx;
+
+}
+.xc-hookst{
+ border: 1rpx solid #999;
+
+}
+.xc-hookst.ons{
+ width: 42rpx;
+height: 42rpx;
+margin-left: 20rpx;
+
+}
+.is_use_coupon{
+ width: 65%;
+justify-content: flex-end;
+padding-top: 10rpx;
+
+
+}
+.xc-hooka{
+ transform: rotate(-135deg);
+text-align: center;
+
+}
+.xc-hooka.sn{
+ width: 45rpx;
+height: 45rpx;
+font-size: 28rpx;
+line-height: 44rpx;
+margin-left: 20rpx;
+
+}
+.color-gray{
+ color: #808080;
+}
+.n_guige{ display: inline-block; background:rgb(236, 236, 236); color: rgb(63,63,63); padding: 3rpx 10rpx; border-radius: 3rpx }
+.gift_image{ width: 60rpx; height: 60rpx; position: absolute; top: 0; left: 0}
+
+.quan_num_show{ padding: 4rpx 6rpx; background-color:#ea5551; color:#fff; border-radius: 6rpx;margin-left:10rpx;font-size:24rpx;}
+
+.navigator-hover {
+ background: none;
+ opacity: 1;
+}
+
+.plus_buy{
+ background-color: #fff;
+ margin:15rpx 0;
+ padding: 20rpx 10rpx;
+ position: relative;
+}
+
+
+.card_bg {
+ box-sizing: border-box;
+ padding: 2rpx 10rpx;
+ height: 28rpx;
+ border-radius: 26rpx;
+ font-size: 18rpx;
+ line-height: 28rpx;
+ max-width: 210rpx;
+ background: #333;
+ color: #fff;
+ margin-left: 8rpx;
+ position:relative;
+ top:7rpx;
+}
+
+.card_bg image {
+ width: 19rpx;
+ height: 19rpx;
+ margin-right: 8rpx;
+}
+
+/* .card_bg .card_name {
+ max-width: 76rpx;
+ width: auto;
+ overflow: hidden;
+ white-space: nowrap;
+} */
+
+.card_name {
+ position: relative;
+ top: -4rpx;
+ margin-left: 6px;
+}
+
+.car_tri_up {
+ width: 0;height: 0;
+ border-left: 20rpx solid transparent;
+ border-right: 20rpx solid transparent;
+ border-bottom: 20rpx solid #fff;
+ position: absolute;
+ right: 20rpx;
+ top:-10rpx
+}
+.card_op{
+ position: absolute;
+ right: 20rpx;
+ top:36rpx
+}
+
+
+.tab-container {
+ font-size: 28rpx;
+ margin-top: 20rpx;
+ display: flex;
+}
+
+.tab-wrapper {
+ background-color: #ccc;
+ display: flex;
+ border-radius: 40rpx;
+ overflow: hidden;
+}
+
+.tab {
+ padding: 20rpx 30rpx;
+
+}
+
+
+.tab.active {
+ background-color: white;
+ border-radius: 40rpx;
+}
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js
index 8ccc19d..d69e5c1 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.js
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -1,8 +1,7 @@
-var t = require("../../../../utils/util.js"),
- ut = t,
+var ut = require("../../../../utils/util.js"),
e = require("../../../../utils/common.js"),
a = require("../../../../utils/wxParse/wxParse.js"),
- s = getApp(),
+ s = getApp(),app=s,
i = s.request,
rq = i,
oo = s.globalData,
@@ -210,7 +209,6 @@ Page({
//是否点赞中
iszaning: 0,
-
select_store: 0, //选择更多
index: 1,
more_store: 0, //选择门店
@@ -249,15 +247,14 @@ Page({
fir_goods: null,
share_hidden: false,
+ pre_arr:null,
},
//------初始化加载----------
onLoad: function (t) {
-
- var ee = this,
- that = ee,
- th = ee,
- gid =t.goods_id,
+ var ee = this, that = ee, th = ee,
+ pre_id=t.pre_id,
+ gid=t.goods_id,
first_leader = t.first_leader,
room_id = t.room_id,
room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
@@ -296,18 +293,21 @@ Page({
if (gid == undefined || gid == null || gid == "") {
var gid_str = decodeURIComponent(t.scene);
gid_str = gid_str.split("_");
- gid = gid_str[0];
+ pre_id = gid_str[0];
if (gid_str.length > 1) {
- first_leader = gid_str[1];
+ pre_id = gid_str[1];
+ first_leader = gid_str[2];
}
//-- 如果有room_id的获取 --
- if (gid_str.length > 2 && gid_str[2]) {
+ if (gid_str.length > 2 && gid_str[3]) {
room_id = gid_str[2];
room_user_share = 1;
}
-
}
- ee.setData({ gid: gid });
+
+ this.data.gid=gid;
+ this.data.pre_id=pre_id;
+
if (first_leader) {
console.log("log---".first_leader);
getApp().globalData.first_leader = first_leader;
@@ -418,68 +418,6 @@ Page({
})
}
});
-
- //获取用户的默认门店
- getApp().get_user_store(function (e) {
- if (!e) {
- th.data.fir_def_store = {}; //赋值空对象
- return false;
- }
- var ee = JSON.parse(JSON.stringify(e));
- //--定时器推迟一下--
- setTimeout(function () {
- if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
- //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
- if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
- //th.data.fir_def_store={}; //赋值空对象
- //return false;
- //th.data.fir_def_store.is_no_dis=1;
- ee.is_no_dis = 1;
- }
-
- var appd = getApp().globalData;
- var w_time = setInterval(function () {
- if (that.data.is_get_local_ok == 0) return false;
- clearInterval(w_time);
- var distance = null;
- var e = JSON.parse(JSON.stringify(ee));
-
- //如果有开启近距离的话,同时距离优不一样了
- if (that.data.lat != null) {
- //如果经纬度有变化的话
- if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
- that.set_def_storage(e);
-
- } else {
- //要用接口是获取距离,js的计算不准
- getApp().request.promiseGet("/api/weshop/pickup/list", {
- data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon },
- }).then(res => {
- if (res.data.code == 0) {
- e = res.data.data.pageData[0];
- if (e) {
- e.is_no_dis = ee.is_no_dis;
- appd.pk_store = e;
- that.set_def_storage(e);
- }
-
- }
- })
- }
- appd.lat = that.data.lat;
- appd.lon = that.data.lon;
-
- } else {
- if (e) {
- e.distance = null;
-
- that.set_def_storage(e);
- }
- }
- }, 500)
- }, 700)
- });
-
//更新点击量
getApp().request.put("/api/weshop/goods/updateClick", {
data: { store_id: os.stoid, goods_id: gid }
@@ -487,58 +425,17 @@ Page({
},
- //--- 设置一下默认库存的数量 ----
- set_def_storage(ee) {
- var that = this, th = this;
- getApp().getConfig2(function (e) {
- var sales_rules = e.sales_rules;
- if (sales_rules == 2) {
- getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () {
- var lock = 0, plist = null;
- var gd = that.data.fir_goods;
- //先读取门店的lock,采用链式写法,少用await
- getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
- data: { store_id: os.stoid, wareId: that.data.fir_goods.goods_id, storageId: ee.pickup_id, pageSize: 1000 }
- }).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
- }
- //---通过接口获取门店的线下库存信息--
- return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
- data: { storageNos: ee.pickup_no, wareIds: encodeURIComponent(th.data.data.erpwareid), storeId: os.stoid }
- })
- }).then(res => {
- if (res.data.code == 0 && res.data.data.total > 0) {
- plist = res.data.data.pageData[0];
- }
- if (plist && plist.CanOutQty - lock > 0) {
- ee.CanOutQty = plist.CanOutQty - lock;
- } else {
- ee.CanOutQty = 0;
- }
- //--给门店赋值线下库存--
- that.data.fir_def_store = ee;
- that.setData({
- def_pick_store: ee,
- sto_sele_name: ee.pickup_name,
- sto_sele_id: ee.pickup_id,
- sto_sele_distr: ee.distr_type
- })
- })
- })
- } else {
+ //--- 设置一下默认库存的数量 ----
+ set_def_storage(ee) {
+ var that = this, th = this;
that.data.fir_def_store = ee;
that.setData({
- def_pick_store: ee,
- sto_sele_name: ee.pickup_name,
- sto_sele_id: ee.pickup_id,
- sto_sele_distr: ee.distr_type
+ def_pick_store: ee,
+ sto_sele_name: ee.pickup_name,
+ sto_sele_id: ee.pickup_id,
+ sto_sele_distr: ee.distr_type
})
- }
- })
-
- },
+ },
//------------程序初始化入口-------------
@@ -553,36 +450,7 @@ Page({
fir_quan = null,
mapurl = null,
mapurl_f_img = null;
- //------获取预售从表----------
- await getApp().request.get("/api/weshop/marketing/marketingPresellList/page", {
- data: {
- is_end: 0,
- store_id: os.stoid,
- timetype: 1,
- goods_id: gid
- },
- success: function (res) {
- if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) {
- var arr = res.data.data.pageData[0];
- let presell_id=arr.presell_id;
- th.setData({
- presellList: arr,
- })
- //------获取预售主表----------
- getApp().request.get(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {
- success: function (res) {
- console.log(res);
- if (res.data.code == 0 && res.data.data) {
- th.setData({
- presellForm: res.data.data,
- });
- th.countDown(res.data.data.end_time)
- }
- }
- })
- }
- }
- });
+
this.get_sto();
//------图片滚动----------
await getApp().request.promiseGet("/api/weshop/goodsimages/page", {
@@ -717,12 +585,12 @@ Page({
//---展示---
onShow: function () {
- console.log('djfijsaoifjoisadjfoij');
var goods_list = null, th = this, that = this;
+
+ //-- 如果是预览图片,页面不重新更新 --
var show_prew_img = this.data.show_prew_img
if (show_prew_img) {
- show_prew_img = 0;
- return false;
+ this.data.show_prew_img = 0; return false;
}
//优惠券要实时更新
@@ -743,196 +611,205 @@ Page({
}, 300)
this.data.is_timer = 1;
- var ee = this,
- gid = this.data.gid,
- i = getApp().request;
+ var ee = this,gid = this.data.gid,i = getApp().request;
this.wait_for_store_config();
- i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {
- failRollback: !0,
- success: function (t) {
- console.log(t);
- if (t.data.code == 0) {
- if (t.data.data.is_on_sale != 1) {
- wx.showModal({
- title: '商品已经下架',
- showCancel: !1,
- complete: function () {
- wx.navigateBack();
- }
- });
- }
+ this.get_pre_prom(function () {
+ i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {
+ failRollback: !0,
+ success: function (t) {
+ console.log(t);
+ if (t.data.code == 0) {
+ if (t.data.data.is_on_sale != 1) {
+ wx.showModal({
+ title: '商品已经下架',
+ showCancel: !1,
+ complete: function () {
+ wx.navigateBack();
+ }
+ });
+ }
+ var timestamp = Date.parse(new Date());
+ timestamp = timestamp / 1000;
+ if (t.data.data.on_time > timestamp) {
+ wx.showModal({
+ title: '商品还未上架',
+ showCancel: !1,
+ complete: function () {
+ wx.navigateBack();
+ }
+ });
+ }
- var timestamp = Date.parse(new Date());
- timestamp = timestamp / 1000;
- if (t.data.data.on_time > timestamp) {
- wx.showModal({
- title: '商品还未上架',
- showCancel: !1,
- complete: function () {
- wx.navigateBack();
- }
- });
- }
+ if (t.data.data.down_time > 0) {
+ if (t.data.data.down_time < timestamp) {
+ wx.showModal({
+ title: '商品已经到期下架',
+ showCancel: !1,
+ complete: function () {
+ wx.navigateBack();
+ }
+ });
+ }
+ }
+ //动态获取商品名称
+ wx.setNavigationBarTitle({
+ title: t.data.data.goods_name,
+ });
- if (t.data.data.down_time > 0) {
- if (t.data.data.down_time < timestamp) {
- wx.showModal({
- title: '商品已经到期下架',
- showCancel: !1,
- complete: function () {
- wx.navigateBack();
- }
- });
- }
- }
- //动态获取商品名称
- wx.setNavigationBarTitle({
- title: t.data.data.goods_name,
- });
+ //-- 把商品的赋值 --
+ ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data));
- //-- 判断是不是组合购活动,必须要登录后才能判断 --
- if (getApp().globalData.userInfo && t.data.data.prom_type == 7) {
- //获取活动信息
- var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" +
- t.data.data.prom_id + "/" + getApp().globalData.userInfo.user_id;
- getApp().request.get(url, {
- success: function (e) {
- if (e.data.code == 0 && e.data.data) {
- if (ut.gettimestamp() < e.data.data.start_time) {
- return false;
- }
- if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) {
- //-- 获取商品列表 --
- th.setData({ zh_act: e.data.data });
- }
+ //获取用户的默认门店
+ getApp().get_user_store(function (e) {
+ if (!e) {
+ th.data.fir_def_store = {}; //赋值空对象
+ return false;
+ }
+ var ee = JSON.parse(JSON.stringify(e));
- }
- }
- });
- }
+ if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
+ //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
+ if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
+ ee.is_no_dis = 1;
+ }
- //-- 把商品的赋值 --
- ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data));
- ee.check_is_youhui(ee.data.gid);
+ var appd = getApp().globalData;
+ var w_time = setInterval(function () {
+ if (that.data.is_get_local_ok == 0) return false;
+ clearInterval(w_time);
+ var e = JSON.parse(JSON.stringify(ee));
+
+ //如果有开启近距离的话,同时距离优不一样了
+ if (that.data.lat != null) {
+ //如果经纬度有变化的话
+ if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
+ that.set_def_storage(e);
+
+ } else {
+ //要用接口是获取距离,js的计算不准
+ getApp().request.promiseGet("/api/weshop/pickup/list", {
+ data: {
+ store_id: os.stoid,
+ pickup_id: e.pickup_id,
+ lat: th.data.lat,
+ lon: th.data.lon
+ },
+ }).then(res => {
+ if (res.data.code == 0) {
+ e = res.data.data.pageData[0];
+ if (e) {
+ e.is_no_dis = ee.is_no_dis;
+ appd.pk_store = e;
+ that.set_def_storage(e);
+ }
+
+ }
+ })
+ }
+ appd.lat = that.data.lat;
+ appd.lon = that.data.lon;
+
+ } else {
+ if (e) {
+ e.distance = null;
+
+ that.set_def_storage(e);
+ }
+ }
+ }, 500)
+ });
- t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
- var cur_price = t.data.data.shop_price;
- if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {
- var cfile = getApp().globalData.userInfo.card_field;
- if (t.data.data[cfile]) {
- cur_price = t.data.data[cfile];
- }
- }
- var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString();
- txt = parseFloat(txt);
- t.data.data['disc'] = txt;
+ t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
- if (t.data.data.original_img.indexOf(o.imghost) == -1)
- t.data.data.original_img = o.imghost + t.data.data.original_img;
+ var cur_price = t.data.data.shop_price;
+ if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {
+ var cfile = getApp().globalData.userInfo.card_field;
+ if (t.data.data[cfile]) {
+ cur_price = t.data.data[cfile];
+ }
+ }
+ var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString();
+ txt = parseFloat(txt);
- if (t.data.data.goods_content == null) t.data.data.goods_content = "";
+ t.data.data['disc'] = txt;
+ if (t.data.data.original_img.indexOf(o.imghost) == -1)
+ t.data.data.original_img = o.imghost + t.data.data.original_img;
- //-----商品详情---
- if (!t.data.data.goods_content) t.data.data.goods_content = " ";
- a.wxParse("content", "html", t.data.data.goods_content, ee, 6);
- e.wxParseAddFullImageUrl(ee, "content");
+ if (t.data.data.goods_content == null) t.data.data.goods_content = "";
- ee.setData({
- data: t.data.data,
- sele_g: t.data.data,
- userInfo: getApp().globalData.userInfo
- });
+ //-----商品详情---
+ if (!t.data.data.goods_content) t.data.data.goods_content = " ";
+ a.wxParse("content", "html", t.data.data.goods_content, ee, 6);
+ e.wxParseAddFullImageUrl(ee, "content");
+ ee.setData({
+ data: t.data.data,
+ sele_g: t.data.data,
+ userInfo: getApp().globalData.userInfo
+ });
- //获取统一条形码,普通商品和优惠促销的商品
- if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 2 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7) {
- //默认门店要拿下门店库存
- 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.get_sku(o.stoid, t.data.data, gid);
- }
- else {
- var gg = "", item = t.data.data;
- if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = "";
- if (item.goods_color == "null" || item.goods_color == null) item.goods_color = "";
+ ee.data.g_buy_num = new Map();
- if (item.goods_spec != "" && item.goods_color != "") {
- gg = item.goods_spec + "/" + item.goods_color;
- } else if (item.goods_spec != "" || item.goods_color != "") {
- gg = item.goods_spec + item.goods_color;
- } else {
- gg = "规格1";
- }
- t.data.data.gg = gg;
- var uu = [];
- uu.push(t.data.data);
- ee.setData({
- sku_g: uu,
- });
- }
- ee.data.g_buy_num = new Map();
- ee.check_prom(gid, ee.data.data.prom_type, ee.data.data.prom_id);
+ if (ee.data.cat_name == '') {
+ //过去国别,分类,品牌的名称
+ i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, {
+ success: function (t) {
+ var dd = t.data.data;
+ if (t.data.code == 0) {
+ th.setData({
+ cat_name: dd.name
+ });
+ }
+ }
+ });
+ //过去国别,分类,品牌的名称
+ i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, {
+ success: function (t) {
+ var dd = t.data.data;
+ if (t.data.code == 0) {
+ th.setData({
+ brand_name: dd.name
+ });
+ }
+ }
+ });
+ //过去国别,分类,品牌的名称
+ i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, {
+ success: function (t) {
+ var dd = t.data.data;
+ if (t.data.code == 0) {
+ th.setData({
+ nation_name: dd.name
+ });
+ }
+ }
+ });
+ }
- var th = ee;
- if (ee.data.cat_name == '') {
- //过去国别,分类,品牌的名称
- i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, {
- success: function (t) {
- var dd = t.data.data;
- if (t.data.code == 0) {
- th.setData({
- cat_name: dd.name
- });
}
- }
- });
- //过去国别,分类,品牌的名称
- i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, {
- success: function (t) {
- var dd = t.data.data;
- if (t.data.code == 0) {
- th.setData({
- brand_name: dd.name
- });
- }
- }
- });
- //过去国别,分类,品牌的名称
- i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, {
- success: function (t) {
- var dd = t.data.data;
- if (t.data.code == 0) {
- th.setData({
- nation_name: dd.name
- });
+ else {
+ wx.showModal({
+ title: t.data.msg,
+ showCancel: !1,
+ complete: function () {
+ wx.navigateBack();
+ }
+ });
}
- }
- });
- }
-
- }
- else {
- wx.showModal({
- title: t.data.msg,
- showCancel: !1,
- complete: function () {
- wx.navigateBack();
}
- });
- }
- }
- });
- this.data.enterAddressPage && (this.data.enterAddressPage = !1);
+ });
+ ee.data.enterAddressPage && (this.data.enterAddressPage = !1);
+ })
+
+
},
enterAddress: function () {
@@ -1054,127 +931,15 @@ Page({
var th = this;
var ind = t.currentTarget.dataset.openSpecModal_ind;
if (!ind) ind = t.currentTarget.dataset.openspecmodal_ind;
- th.setData({
- open_ind_store: ind
+ th.setData({
+ open_ind_store: ind
});
- //如果是秒杀的话,要看redis够不够
- if (this.data.prom_type == 1) {
- this.getactLen(function (num) {
- if (num < th.data.goodsInputNum) {
- getApp().my_warnning("秒杀库存不足!", 0, th);
- return false;
- } else {
- th.add_cart_func(t);
- }
- });
- } else {
- th.add_cart_func(t);
- }
+
+ th.add_cart_func(t);
+
},
-
- //-- 加入购物的函数 --
- add_cart_func_inte: 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.data;
- 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: '超出商品限购'
- });
- return false;
- }
- }
- //---判断商品是否超出活动限购---
- if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) {
- if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {
- wx.showModal({
- title: '提示',
- content: '超出商品活动限购'
- });
- 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)
- this.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: th.data.prom_price,
- integral: th.data.prom_integral,
- member_goods_price: o.shop_price,
- goods_name: o.goods_name,
- goods_sn: o.goods_sn,
- sku: o.sku,
- };
-
- //---是不是从收藏夹出来的---
- 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 (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;
- //}
-
- //-----如果是秒杀,团购,积分购,拼团-----
- 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); //立即购买下一步
-
- })
- },
-
//-- 加入购物的函数 --
add_cart_func: function (t) {
var i = getApp().request;
@@ -1186,12 +951,7 @@ Page({
return s.my_warnning("还未登录!", 0, this);
}
- var e = this,
- th = e,
- a = 0,
- o = this.data.sele_g;
- a = o.goods_id;
-
+ var e = this,th = e, o = this.data.sele_g,a = o.goods_id;
//----------添加到购物车时,要判断限购数量,--------
e.get_buy_num(o, function (ee) {
//---判断商品是否超出限购---
@@ -1234,6 +994,7 @@ Page({
goods_name: o.goods_name,
goods_sn: o.goods_sn,
sku: o.sku,
+ presell_list_id:th.data.presellList.id,
};
//---是不是从收藏夹出来的---
@@ -1270,163 +1031,22 @@ Page({
newd.pricing_type = o.pricing_type;
}
- //-----如果是秒杀,团购,积分购,拼团-----
- if (th.data.prom_type == 1) {
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;
+ newd.prom_type = 8;
+ newd.prom_id = o.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 == 2 || th.data.prom_type == 4 || th.data.prom_type == 5) {
- 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); //加入购物车下一步
- }
- }
+
})
},
//---加入购物车的最后一步---
add_cart_next(e, t, a, o, newd, CanOutQty) {
var th = this, i = getApp().request;
- //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------
- if (o.prom_type != 1 && ((o.prom_type != 6 && o.prom_type != 4) || th.data.is_normal)) {
- var conf = th.data.bconfig;
- if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) {
- var s_list = JSON.parse(conf.switch_list);
- 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) {
@@ -1506,102 +1126,29 @@ Page({
});
}
}
- });
-
- }
- //else "exchange" == t.currentTarget.dataset.action ? this.exchange(d) : this.buyNow(d);
- else {
-
- 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;
- }
- }
-
- }
+ })
+ }else {
newd['pick_name'] = th.data.sto_sele_name;
newd['pick_dis'] = th.data.sto_sele_distr;
th.buyNow(newd);
}
},
-
- //----------购买虚拟商品------
- buyVirtualGoods: function (e) {
- Object.assign(e, {
- goods_name: this.data.data.goods.goods_name,
- spec_name: this.data.select.specName,
- price: this.data.select.price
- }), wx.navigateTo({
- url: "/pages/virtual/buy_step/buy_step?" + t.Obj2Str(e)
- });
- },
- //----------积分兑换---------
- exchange: function (e) {
- this.data.shippingCost < 0 || this.data.select.stock <= 0 || wx.navigateTo({
- url: "/pages/cart/integral/integral?" + t.Obj2Str(e)
- });
- },
-
-
//----------立即购买-----------
buyNow: function (e) {
- // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, {
- // action: "buy_now"
- // }),
+
this.setData({
openSpecModal: 0,
openSpecModal_inte: 0,
openSpecModal_inte_normal: 0,
openSpecModal_pt: 0,
})
-
- if (e.prom_type == 4) {
- s.set_b_now(e);
- var url = "/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id;
- getApp().goto(url);
- } else {
- //要判断积分购的普通购买有没有参加优惠活动
- if (e.is_integral_normal == 1) {
- this.check_nor_promgood(e.goods_id, function (res) {
- if (res && res.cat_id) {
- e.prom_type = 3;
- e.prom_id = res.cat_id
- }
- s.set_b_now(e);
- /*--
- wx.redirectTo({
- url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
- });--*/
- getApp().goto("/packageC/pages/presell/cart/cart?is_bnow=1&goods_id=" + e.goods_id)
-
- })
- } else {
- s.set_b_now(e);
- /*--
- wx.redirectTo({
- url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
- });--*/
- getApp().goto("/packageC/pages/presell/cart/cart?is_bnow=1&goods_id=" + e.goods_id)
- }
-
- }
+
+ app.set_b_now(e);
+ getApp().goto("/packageC/pages/presell/cart/cart2_pre");
+
+
},
//----------增加购买数量-----------
@@ -1654,7 +1201,7 @@ Page({
}
//--判断商品是否超出活动限购--
- if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) {
+ if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) {
if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
wx.showModal({
title: '超出商品活动限购',
@@ -1667,24 +1214,8 @@ Page({
}
}
- if (th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) {
- var redis_num = 0;
- //------判断活动是否抢光-----
- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
- os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, {
- 1: 1
- }).then(res => {
- redis_num = res.data.data;
- });
- if (t > redis_num) {
- wx.showModal({
- title: '超出商品活动库存',
- });
- th.setData({ goodsInputNum: redis_num })
- return false;
- }
- }
+
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)) {
@@ -1795,7 +1326,6 @@ Page({
sele_g: this.data.data,
gid: this.data.data.goods_id
})
-
this.sele_spec_chech_activity();
}
@@ -2173,14 +1703,13 @@ Page({
//-----图片失败,默认图片-----
bind_bnerr2: function (e) {
-
var _errImg = e.target.dataset.errorimg;
var _errObj = {};
_errObj[_errImg] = this.data.iurl + "/miniapp/images/hui_hear_pic.png"
this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
},
- //----------装载同一条形码的商品----------
+ //----------装载同一活动中的商品----------
async get_sku(stoid, gd, g_id, is_normal, func) {
var tt = this, arrdata = null;
var now = ut.gettimestamp();
@@ -2192,7 +1721,9 @@ Page({
isonsale: 1,
is_on_sale: 1,
pageSize: 500,
- orderField: 'sort'
+ orderField: 'sort',
+ prom_id:tt.data.presellForm.id,
+ prom_type:8,
}
}).then(res => {
var e = res;
@@ -2234,7 +1765,6 @@ Page({
if (res.data.code == 0) prom = res.data.data;
})
break
-
}
@@ -2314,43 +1844,8 @@ Page({
gid: gid
});
-
-
- that.check_is_youhui(gid, that.data.is_normal);
-
- var ty = 0;
- this.get_sto(that.data.is_normal);
-
-
- //默认门店要拿下门店库存
- if (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", {
- data: { store_id: os.stoid, wareId: ee.data.sele_g.goods_id, storageId: that.data.def_pick_store.pickup_id, pageSize: 1000 }
- }).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
- }
- //---通过接口获取门店的线下库存信息--
- return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
- data: { storageNos: that.data.def_pick_store.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid }
- })
- }).then(res => {
- if (res.data.code == 0 && res.data.data.total > 0) {
- plist = res.data.data.pageData[0];
- }
- if (plist && plist.CanOutQty - lock > 0) {
- that.data.def_pick_store.CanOutQty = plist.CanOutQty - lock;
- } else {
- that.data.def_pick_store.CanOutQty = 0;
- }
- //--给门店赋值线下库存--
- th.setData({ def_pick_store: that.data.def_pick_store });
- })
- }
-
+ //that.check_is_youhui(gid, that.data.is_normal);
+ this.get_sto();
this.sele_spec_chech_activity();
},
@@ -2415,8 +1910,7 @@ Page({
//---------拿出门店分类和门店------------
get_sto(e) {
- var th = this, that = this;
- var is_normal = e;
+ var th = this,is_normal = e;
if (e == 1) {
th.setData({ is_normal: 1 })
@@ -2891,24 +2385,11 @@ Page({
//加载更多是靠这个函数
onReachBottom: function () {
if (this.data.activeCategoryId == 2) {
- if (!this.data.comments_no_more) this.requestComments_new();
- }
-
- var goods_list = this.selectComponent("#goods_list"); //组件的id
- if (goods_list) goods_list.get_list();
- },
-
- //--------检查是否活动,活动是否开始,或者是否结束-------
- async check_prom(gid, prom_type, prom_id) {
- var ee = this,
- th = ee;
- if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7) {
- this.setData({
- prom_type: 0,
- isshow: 1,
- });
- return false;
- }
+ if (!this.data.comments_no_more) this.requestComments_new();
+ }
+
+ var goods_list = this.selectComponent("#goods_list"); //组件的id
+ if (goods_list) goods_list.get_list();
},
//--获取有多少人在开团--
@@ -3107,213 +2588,6 @@ Page({
});
},
- //--------拼团玩法显示详情--------
- show_pt_xx: function (e) {
- this.setData({
- pd_xx: 1,
- })
- },
- close_pt_xx: function () {
- this.setData({
- pd_xx: 0,
- })
- },
-
-
- //-----------------拼单生成方法---------------------
- addCart_pt: function () {
- var th = this;
- if (this.data.is_normal == 0) {
- //看一下有没有起购数,如果有起购数,要计算起购数
- var qnum = parseFloat(th.data.prom_act.minbuynum);
- if (qnum > 0 && th.data.goodsInputNum < qnum) {
- getApp().confirmBox("拼团商品至少要买" + qnum + "件!");
- return false;
- }
-
- th.addcart_pt_func();
- } else {
- th.addcart_pt_func();
- }
- },
-
- addcart_pt_func: function () {
- if (oo.user_id == null) {
- s.my_warnning("还未登录!", 0, this);
- return;
- }
- var e = this,
- th = e,
- o = this.data.sele_g;
- if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
-
- //----------添加到购物车时,要判断限购数量,--------
- 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.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 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: '超出商品活动库存'
- });
-
- th.setData({ goodsInputNum: redis_num })
-
- return false;
- }
- }
-
- 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.sto_sele_name == null || th.data.sto_sele_name == undefined)
- this.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,
- goods_name: o.goods_name,
- goods_sn: o.goods_sn,
- sku: o.sku,
- };
-
- //---是不是从收藏夹出来的---
- 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.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.is_normal == 1) {
- var conf = th.data.bconfig;
- if (conf.switch_list) {
- var s_list = JSON.parse(conf.switch_list);
- //如果后台有开启等级价的功能
- if (parseInt(s_list.rank_switch) == 2) {
- 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 == 6 && 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;
- }
-
- 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.check_nor_promgood(newd.goods_id, function (e) {
- if (e && e.act_id) {
- newd['prom_type'] = 3;
- newd['prom_id'] = e.act_id;
- }
- th.buyNow(newd)
- })
- }
- else th.buyNow_pt(newd);
- })
- },
- //----------立即购买_pt-----------
- buyNow_pt: function (e) {
- s.set_b_now(e);
- wx.navigateTo({
- url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + e.goods_id,
- });
- },
-
//-------跳转pt商品-------
go_to_nopay: function () {
var th = this;
@@ -3338,7 +2612,7 @@ Page({
},
- //---拼团倒计时---
+ //---倒计时---
countDown2() {
if (!this.data.is_timer) return false;
var th = this;
@@ -3379,77 +2653,6 @@ Page({
}
setTimeout(th.countDown2, 1000);
},
- //跳转参加团
- go_cj_team: function (e) {
- var ind = e.currentTarget.dataset.ind;
- var item = this.data.teamgroup[ind];
- var id = item.id;
- var th = this;
-
- getApp().request.get("/api/weshop/order/page", {
- data: {
- pt_prom_id: item.team_id,
- user_id: oo.user_id,
- store_id: os.stoid,
- pageSize: 1,
- page: 1
- },
- success: function (e) {
- if (e.data.code != 0) {
- getApp().my_warnning("读取订单失败", 0, th);
- return fasle;
- }
- //--跳转到已经购买的情况--
- if (e.data.data.pageData.length > 0) {
- var odr = e.data.data.pageData[0];
- //还未支付
- if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) {
- wx.showModal({
- title: "您已经购买了该商品待支付中",
- success: function (a) {
- if (a.confirm) {
- wx.navigateTo({
- url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id,
- });
- }
- }
- });
- } else if (odr.pt_status == 1 && odr.order_status == 1) {
-
- if (this.data.is_go_to_team_show) return false;
- this.data.is_go_to_team_show = 1;
- wx.showLoading();
- /*--
- wx.redirectTo({
- url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn,
- });--*/
-
- getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn);
-
- } else {
- wx.navigateTo({
- url: "/pages/team/team_show/team_show?tg_id=" + id,
- });
- }
- }
- //--跳转到参团--
- else {
- wx.navigateTo({
- url: "/pages/team/team_show/team_show?tg_id=" + id,
- });
- }
- }
- })
-
- },
-
- //跳到团更多
- go_t_more: function () {
- var team_id = this.data.prom_id;
- wx.navigateTo({
- url: "/pages/team/team_more/team_more?team_id=" + team_id,
- });
- },
//--点赞功能--
click_zan: function (e) {
@@ -3877,8 +3080,6 @@ Page({
context.setFontSize(22 * unit)
context.fillText("长按识别二维码", 40 * unit, 806 * unit);
context.fillText("立即开始兑换", 40 * unit, 846 * unit);
-
-
}
//---二维吗图---
@@ -4822,56 +4023,6 @@ Page({
wx.navigateTo({ url: url, })
},
- //---检查有没有优惠活动---
- check_is_youhui: function (gid, is_nor) {
- var th = this;
- //如果是普通购买的时候,要进行调用
- if (is_nor) {
- getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + gid, {
- success: function (res) {
- if (res.data.code == 0) {
- var r_data = res.data.data;
- th.setData({
- prom_goods: r_data.promGoodsLists,
- })
- th.is_show_more_buy();
- }
- },
- })
-
- } else {
- //调用接口判断订单优惠,
- getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0", {
- success: function (res) {
- if (res.data.code == 0) {
- var r_data = res.data.data;
- var max = 0, min = 0;
- if (r_data.collocationList) {
- for (var i in r_data.collocationList) {
- if (max == 0) max = r_data.collocationList[i].price;
- if (min == 0) min = r_data.collocationList[i].price;
-
- if (max < parseFloat(r_data.collocationList[i].price)) max = r_data.collocationList[i].price;
- if (min > parseFloat(r_data.collocationList[i].price)) min = r_data.collocationList[i].price;
- }
- r_data.collocationPromList.max = (max + th.data.data.shop_price).toFixed(2);
- r_data.collocationPromList.min = (min + th.data.data.shop_price).toFixed(2);
- }
- th.setData({
- order_prom: r_data.promOrder,
- collocationGoods: r_data.collocationPromList,
- prom_goods: r_data.promGoodsLists,
- })
- th.is_show_more_buy();
- }
- }
-
- })
- }
-
-
- },
-
closePoster() {
this.setData({
showPoster: false,
@@ -5014,29 +4165,6 @@ Page({
},
- //-- 积分购 --
- go_pay_integral: function () {
- this.get_sto(0)
- this.setData({ openSpecModal_inte: 1, goodsInputNum: 1 });
- },
- //-- 积分购普通购买 --
- go_pay_integral_normal: function () {
- var th = this;
- if (th.data.sku_g_pt) {
- this.get_sto(1)
- this.setData({ openSpecModal_inte_normal: 1 });
- } else {
- th.get_sto(1);
- th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () {
- th.setData({
- is_normal: 1,
- openSpecModal_inte_normal: 1
- });
- });
- }
- this.check_is_youhui(th.data.gid, 1);
- },
-
closeSpecModal_inte: function () {
this.setData({ openSpecModal_inte: 0 });
},
@@ -5053,97 +4181,100 @@ Page({
},
addCart_inte: function (t) {
- this.add_cart_func_inte(t);
- },
-
-
-
-
- onShareTimeline() {
- var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
- if (!store_name)
- store_name = getApp().globalData.setting.appName;
- return {
- title: this.data.data.goods_name + '-' + store_name,
- imageUrl: this.data.gallery[0].image_url,
- }
+ this.add_cart_func_inte(t);
},
- clickCollapse() {
- this.setData({
- flag: !this.data.flag,
- })
- },
+ onShareTimeline() {
+ var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
+ if (!store_name)
+ store_name = getApp().globalData.setting.appName;
+ return {
+ title: this.data.data.goods_name + '-' + store_name,
+ imageUrl: this.data.gallery[0].image_url,
+ }
+ },
- clickShare() {
- this.setData({
- share_hidden: true,
- });
- },
+ clickCollapse() {
+ this.setData({flag: !this.data.flag,})
+ },
- send() {
- this.setData({
- share_hidden: false,
- });
- },
+ clickShare() {
+ this.setData({share_hidden: true,});
+ },
- cancel() {
- this.setData({
- share_hidden: false,
- });
- },
+ send() {
+ this.setData({share_hidden: false,});
+ },
- //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动
- check_nor_promgood(goods_id, back) {
- getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, {
- success: function (res) {
- if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) {
- var obj = {
- act_id: res.data.data.promGoodsLists[0].prom_id,
- }
- back(obj);
- } else {
- back(0)
- }
- }
- })
- },
+ cancel() {
+ this.setData({
+ share_hidden: false,
+ });
+ },
- go_zh: function (e) {
- var id = e.currentTarget.dataset.id;
- getApp().goto("/packageB/pages/zuhegou/index/index?id=" + id);
- },
+ //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动
+ check_nor_promgood(goods_id, back) {
+ getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, {
+ success: function (res) {
+ if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) {
+ var obj = {
+ act_id: res.data.data.promGoodsLists[0].prom_id,
+ }
+ back(obj);
+ } else {
+ back(0)
+ }
+ }
+ })
+ },
- check_zh_acting: function (func) {
- var isok = 1, item = this.data.sele_g;
- //如果有组合购
- var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.userInfo.user_id;
- getApp().request.promiseGet(url, {}).then(res => {
- if (res.data.code == 0 && res.data.data) {
- if (res.data.data.is_show != 1) {
- isok = 0;
+ async get_pre_prom(func){
+ var th = this;
+ var presell_id = null;
+ var pre_arr = null;
+ //------获取预售从表----------
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => {
+ if (res.data.code == 0 && res.data.data) {
+ var arr = res.data.data;
+ presell_id = arr.presell_id;
+ th.setData({
+ presellList: arr,
+ })
+ }
+ })
+ if (!presell_id) {
+ wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000})
+ return false;
}
- //如果活动已经结束
- if (res.data.data.is_end == 1) {
- isok = 0;
+ //------获取预售主表----------
+ await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => {
+ if (res.data.code == 0 && res.data.data) {
+ th.setData({
+ presellForm: res.data.data,
+ });
+ th.countDown(res.data.data.end_time)
+ }
+ })
+ var userInfo = getApp().globalData.userInfo;
+ var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid};
+ if (userInfo) {
+ pre_data.user_id = userInfo.user_id;
}
- //已经结束
- if (ut.gettimestamp() > res.data.data.end_time) {
- isok = 0;
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
+ data: pre_data,
+ }).then(e => {
+ if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
+ pre_arr = e.data.data.pageData[0];
+ th.setData({pre_arr: pre_arr})
+ }
+ })
+ if (!pre_arr) {
+ wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000})
}
- //还未开始
- if (ut.gettimestamp() < res.data.data.start_time) {
- isok = 0;
+ if (func) {
+ func();
}
-
- } else {
- //未找到商品的活动
- isok = 0;
- }
- item.act = res.data.data;
- func(isok);
- })
- }
+ }
});
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
index c0ed359..9db2c73 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -151,7 +151,7 @@
- (配送不匹配)
+ (配送不匹配2)
(库存不足)
@@ -494,10 +494,8 @@
购物车
-
- 立即购买
-
-
+
+
{{filters.format_time(presellForm.end_time,2)}} 预售结束
@@ -527,20 +525,13 @@
{{sele_g.goods_name}}
-
- ¥
-
- {{sele_g[card_field]}}
- {{sele_g.shop_price}}
-
-
- ¥
- {{prom_price}}
+
+
+ ¥{{presellList.presell_money}}
- 券后¥
- {{sele_g.offline_price}}
+ 券后¥{{sele_g.offline_price}}
@@ -589,7 +580,7 @@
(库存不足)
- (配送不匹配)
+ (配送不匹配1)
(库存不足)
@@ -631,27 +622,21 @@
-
- 支付定金(¥9.9)
+
+ 门店的不匹配
-
- 库存不足
-
+ 未找到门店
-
- 库存不足
-
+ 未找到门店
-
- 库存不足
-
+ 未找到门店
@@ -660,44 +645,26 @@
-
-
-
-
- 库存不足
-
-
-
-
- 加入购物车
-
-
- {{sele_g.offline_price?"券后购买":"立即购买"}}
-
-
-
-
-
+
+
-
- 库存不足
-
+ 库存不足
-
- 加入购物车
-
-
- {{sele_g.offline_price?"券后购买":"立即购买"}}
+
+ 支付定金(¥{{presellList.presell_money}})
-
+
+
+
@@ -746,38 +713,7 @@
-
-
-
-
-
-
- 拼团玩法介绍
-
-
-
- 1.开团:
- 选择心仪商品,点击“发起X人团”按钮,付款后即为开团成功;
-
-
- 2.参团:
- 进入朋友分享的页面,点击“立即参团”按钮,付款后即为参团成功,若多人同时支付,支付成功时间较早的人获得参团资格;
-
-
- 3.成团:
- 在开团或参团成功后,点击“邀请小伙伴参团”将页面分享给好友,在有效时间内凑齐人数即为成团,此时商家会开始发货;
-
-
- 4.组团失败:
- 在有效时间内未凑齐人数,即为组团失败,此时付款项会原路退回到支付账户;
-
-
- 5.
- 组团有效期间内,拼购商品订单不允许取消。
-
-
-
-
+
@@ -985,10 +921,7 @@
-
+
\ No newline at end of file
diff --git a/packageC/pages/presell/list/list.js b/packageC/pages/presell/list/list.js
index adbf04d..d6a0eaa 100644
--- a/packageC/pages/presell/list/list.js
+++ b/packageC/pages/presell/list/list.js
@@ -17,10 +17,8 @@ Page({
onLoad: function (t) {
var first_leader = t.first_leader;
var th = this;
-
- console.log("------------");
- console.log(first_leader);
getApp().getConfig();
+ this.data.act_id=t.act_id;
if (first_leader) {
getApp().globalData.first_leader = first_leader;
@@ -52,10 +50,26 @@ Page({
}
})
- //调用列表
- this.get_list();
+ var userInfo=getApp().globalData.userInfo;
+ if(userInfo && goodlist.length==0){
+ //调用列表
+ this.get_list();
+ }else{
+ getApp().goto("/pages/togoin/togoin");
+ }
+ },
+ onShow: function (t) {
+ var userInfo=getApp().globalData.userInfo;
+ if(userInfo && this.data.goodlist.length==0){
+ //调用列表
+ this.get_list();
+ }else{
+ if(getApp().globalData.pre_back==1){
+ getApp().globalData.pre_back=0;
+ getApp().goto("/pages/index/index/index");
+ }
+ }
},
- onShow: function (t) { },
//---小于10的格式化函数----
timeFormat(param) {
return param < 10 ? '0' + param : param;
@@ -105,7 +119,13 @@ Page({
pageSize: 10,
timetype: 1
}
-
+ if(getApp().globalData.userInfo){
+ req.user_id=getApp().globalData.userInfo.user_id;
+ }
+ if(this.data.act_id){
+ req.prom_type=8;
+ req.prom_id=this.data.act_id;
+ }
//调用接口获取数据
getApp().request.get("/api/weshop/marketing/marketingPresellList/page", {
data: req,
@@ -132,6 +152,9 @@ Page({
}
})
},
+ go_index:function () {
+ getApp().goto("/pages/index/index/index");
+ }
});
diff --git a/packageC/pages/presell/list/list.wxml b/packageC/pages/presell/list/list.wxml
index 332fd6a..6adcd1a 100644
--- a/packageC/pages/presell/list/list.wxml
+++ b/packageC/pages/presell/list/list.wxml
@@ -32,12 +32,13 @@
-
+
- {{item.goods_name}}
+ {{item.goods_name}}
@@ -68,11 +69,13 @@
+
+
+ 去首页逛逛
+
+ -- 没有更多 --
-
--- 没有更多 --
-
-
+
diff --git a/packageC/pages/presell/list/list.wxss b/packageC/pages/presell/list/list.wxss
index ce46633..d59852e 100644
--- a/packageC/pages/presell/list/list.wxss
+++ b/packageC/pages/presell/list/list.wxss
@@ -191,5 +191,15 @@ border-radius:20rpx;height:26rpx;
.xc-fill-text{
left:34%;
line-height: 26rpx;
+}
+.bc_btn{
+ margin: 10rpx auto;
+ width: 200rpx;
+ height: 60rpx;
+ text-align: center;
+ line-height: 60rpx;
+ background-color: #ff0000;
+ color: #fff;
+ border-radius: 10rpx;
}
\ No newline at end of file