Commit 0e1b6dccb07af22693fc4bcd76589a096e7a035b

Authored by taiyuan
2 parents 012ae1cb b7efd720

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

packageC/pages/presell/cart/cart2_pre.js 0 → 100644
  1 +var t = getApp(),app=t, a = t.request, ut = require("../../../../utils/util.js");
  2 +var os=t.globalData.setting;
  3 +var regeneratorRuntime = require('../../../../utils/runtime.js');
  4 +var util_pay = require("../../../../utils/pay.js");
  5 +
  6 +Page({
  7 + data: {
  8 + url: t.globalData.setting.url,
  9 + resourceUrl: t.globalData.setting.resourceUrl,
  10 + imgUrl: t.globalData.setting.imghost,
  11 + goods: null,
  12 + order: null,
  13 + orderPrices: null,
  14 + coupons: null,
  15 + coupon: null,
  16 + invoiceToggle: !0,
  17 + payWithUserMoney: !0,
  18 + payWithPoints: !0,
  19 + maxWord: 0,
  20 + enterAddressPage: !1,
  21 + firstEnter: !0,
  22 + //页面获取的参数
  23 + param:null,
  24 + postdata:null,
  25 + //提交订单的格式
  26 + formData: {
  27 + order_amount:0,//支付金额
  28 + total_amount:0,//总价
  29 + all_price:0,//商品卖的总价
  30 + pay_points: 0,//使用积分
  31 + user_money: 0,//使用余额
  32 + couponCode: "",//使用优惠券(多单就用逗号隔开)
  33 + shipping_price:0,//物流费用
  34 + },
  35 +
  36 + /*----------------立即购买---------------------*/
  37 + is_b_now:0, //0是购物车结算 1立即购买
  38 + bn_goods:null, //立即购买时候的调用商品
  39 + bn_use_money:0,//是否使用余额
  40 + bn_exp_type:1, //0是物流 1自提
  41 + bn_pick:0, //选择的门店
  42 + bn_pickname: "", //选择的门店名称
  43 + bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
  44 + /*------------------------*/
  45 + user_addr:null,//物流
  46 + userinfo:null, //获取会员
  47 + /*----------物流选择--------*/
  48 + wu_arr:null,
  49 + index:0,
  50 +
  51 + //判断页面是返回回来的还是 首次进入的
  52 + isclose:1,
  53 + is_express:0,//选择物流的控制器
  54 + yuer:0,
  55 +
  56 + },
  57 + onLoad: function(t) {
  58 + var th = this; this.setData({ is_b_now: 1});
  59 + th.data.postdata=getApp().get_b_now();
  60 + th.data.param=t;
  61 +
  62 + },
  63 + onUnload: function () { this.setData({ isclose: 1 })},
  64 +
  65 + //------获取会员信息-----先获取用户信息,在进行下一步---
  66 + get_info:function(func){
  67 + var user_id = t.globalData.user_id;
  68 + app.auth.get_u(func);
  69 + },
  70 +
  71 + //-------------------获取物流---------------
  72 + get_wuliu(func) {
  73 + var th = this;
  74 + app.getwuliu(function (e) {
  75 + if (th.data.is_default_logistics) {
  76 + //如果第一个不是开启默认,说明要让用户自己选
  77 + if (!e[0].is_default) {
  78 + th.setData({ is_default_logistics: 0 });
  79 + }
  80 + }
  81 + th.setData({ wu_arr: e })
  82 + typeof func == "function" && func();
  83 + })
  84 + },
  85 +
  86 + //------获取会员收货地址-----
  87 + getuser_addr:function(func){
  88 + if (app.globalData.baddr!=null){
  89 + var user_addr =app.globalData.baddr;
  90 + app.globalData.baddr=null;
  91 + func(user_addr);
  92 + }else{
  93 + a.get("/api/weshop/useraddress/page", {
  94 + data: { user_id:app.globalData.user_id, store_id: os.stoid, pageSize: 600 },
  95 + success: function (su) {
  96 +
  97 + var user_addr = su.data.data.pageData;
  98 + var item = null;
  99 + var def_item=null;
  100 + for (var i = 0; i < user_addr.length; i++) {
  101 + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }
  102 + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }
  103 + }
  104 + if (item == null) item = def_item;
  105 + if (item == null) item = user_addr[0];
  106 + if (item == undefined) item = null;
  107 + func(item);
  108 + }
  109 + });
  110 + }
  111 + },
  112 + //----------------展示页面,是再获取用户信息之后--------------
  113 + show_page:function(){
  114 + var th=this;
  115 + var user=getApp().globalData.userInfo;
  116 + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + user.user_id, {
  117 + data:{r:Math.random()},
  118 + success: function (e) {
  119 +
  120 + getApp().globalData.userInfo = e.data.data;
  121 + th.setData({userinfo:e.data.data});
  122 + //获取立即购买的商品信息
  123 + th.get_buy_goods();
  124 +
  125 + //获取提现金额
  126 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  127 + data: { user_id:app.globalData.user_id, store_id: os.stoid, status: 0 },
  128 + success: function (su) {
  129 + if (su.data.code == 0) {
  130 + var yuer = parseFloat(th.data.userinfo.user_money -
  131 + (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);
  132 + if(yuer<0) yuer=0;
  133 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  134 + }
  135 + }
  136 + });
  137 + }
  138 + });
  139 + },
  140 +
  141 + //-----获取立即购买的商品信息----
  142 + get_buy_goods: async function () {
  143 + var th = this, a = getApp().request;
  144 + //定义变量
  145 + var gg = th.data.postdata,act = null,prelist = null;
  146 + var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id;
  147 + await getApp().request.promiseGet(url, {}).then(res => {
  148 + if (res.data.code == 0) {
  149 + act = res.data.data;
  150 + }
  151 + })
  152 + if (!act) {
  153 + wx.showToast({title: "未找到活动", icon: 'none', duration: 3000});
  154 + return false;
  155 + }
  156 + if (act.is_end==1 ) {
  157 + wx.showToast({title:'活动已经结束' , icon: 'none', duration: 3000});
  158 + return false;
  159 + }
  160 + if( ut.gettimestamp()>act.end_time){
  161 + wx.showToast({title:"活动定金支付时间已过期" , icon: 'none', duration: 3000});
  162 + return false;
  163 + }
  164 +
  165 + var url = "/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + gg.presell_list_id;
  166 + await getApp().request.promiseGet(url, {}).then(res => {
  167 + if (res.data.code == 0) {
  168 + prelist = res.data.data;
  169 + }
  170 + })
  171 + if (!prelist) {
  172 + wx.showToast({title: "未找到商品", icon: 'none', duration: 3000});
  173 + return false;
  174 + }
  175 + //-- 调用商品 --
  176 + a.get("/api/weshop/goods/get/" + os.stoid + "/" + gg.goods_id, {
  177 + success: function (t) {
  178 + var gd = t.data.data;
  179 + if (!gd) return false;
  180 +
  181 + t.data.data.original_img = os.imghost + t.data.data.original_img;
  182 + t.data.data['buynum'] = gg.goods_num;
  183 +
  184 + var distr_t = 0, et = 0;
  185 + if (t.data.data.distr_type == 0) {
  186 + distr_t = gg.pick_dis;
  187 + } else {
  188 + distr_t = t.data.data.distr_type;
  189 + }
  190 +
  191 + if(act.presell_type==1){
  192 + switch (distr_t) {
  193 + case 0:
  194 + et = 1;
  195 + //-- 系统后台有设置要默认的 --
  196 + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;
  197 + break;
  198 + case 1:
  199 + et = 1;
  200 + break;
  201 + case 2:
  202 + et = 0;
  203 + break;
  204 + }
  205 + }else{
  206 + et=1; //要付定金的时候
  207 + }
  208 +
  209 + t.data.data.shop_price = prelist.presell_money;
  210 + th.setData({
  211 + bn_goods: t.data.data, bn_pickname: gg.pick_name,prelist:prelist,act:act,
  212 + bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
  213 + });
  214 + //计算价格
  215 + th.calculatePrice2();
  216 + }
  217 + });
  218 + },
  219 +
  220 + //----------子页返回父页触发----------
  221 + onShow: function () {
  222 + var th = this;
  223 + if (th.data.isclose == 0) {
  224 + wx.navigateTo({
  225 + url: "/pages/index/index/index"
  226 + })
  227 + } else {
  228 + this.getuser_addr(function (ie) {
  229 + //更换地址回来要重新调用计算价钱的接口
  230 + th.setData({ user_addr: ie });
  231 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  232 + th.setData({ add_back: 1 });
  233 + if (this.data.bn_goods) th.calculatePrice2();
  234 + }
  235 + })
  236 + //--更新默认地址--,看一下是不是跳到地址页面
  237 + if (!getApp().globalData.is_cart_old) {
  238 + this.update_code();
  239 + } else {
  240 + getApp().globalData.is_cart_old = 0;
  241 + }
  242 + }
  243 +
  244 +
  245 + //先获取是否有关闭使用优惠券
  246 + getApp().getConfig2(function (ee) {
  247 + var json_d = JSON.parse(ee.switch_list);
  248 + th.data.json_d = json_d;
  249 + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  250 + var is_default_logistics = json_d.is_default_logistics;
  251 +
  252 + 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 });
  253 +
  254 + var rank_switch = json_d.rank_switch;
  255 + var max_price = -1;
  256 + var show_card = null;
  257 + var name = "";
  258 + //如果有开等级卡的时候,
  259 + //因为都是调接口,要返回在计算
  260 + if (rank_switch == 2) {
  261 + //-- 获取所有的等级卡, --
  262 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
  263 + {}).then(res => {
  264 + if (res.data.code == 0) {
  265 + var plusCard = res.data.data;
  266 + //-- 循环判断,拿到最贵的那张卡 --
  267 + for (var ih in plusCard) {
  268 + if (plusCard[ih].IsStopBuy == true) { continue; }
  269 + if (max_price < 0) {
  270 + max_price = plusCard[ih].CardFee;
  271 + name = 'card' + plusCard[ih]['CorrPrice'];
  272 + show_card = plusCard[ih];
  273 + } else {
  274 + if (max_price < plusCard[ih].CardFee) {
  275 + max_price = plusCard[ih].CardFee;
  276 + name = 'card' + plusCard[ih]['CorrPrice'];
  277 + show_card = plusCard[ih];
  278 + }
  279 + }
  280 + }
  281 +
  282 + if (show_card) {
  283 + name = name.toLowerCase();
  284 + th.setData({ card_name: name, show_card: show_card })
  285 + }
  286 + }
  287 + //-----先获取物流,再获取用户信息,再展示页面-----
  288 + th.get_wuliu(th.get_info(th.show_page));
  289 + })
  290 + } else {
  291 + //-----先获取物流,再获取用户信息,再展示页面-----
  292 + th.get_wuliu(th.get_info(th.show_page));
  293 + }
  294 + }, 1)
  295 +
  296 + },
  297 + //---------------检查是否有收货地址-------------------
  298 + checkAddressList: function() {
  299 + var t = this;
  300 + return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
  301 + title: "请先填写或选择收货地址~",
  302 + success: function(a) {
  303 + a.confirm ? t.enterAddressPage() : wx.navigateBack();
  304 + },
  305 + fail: function() {
  306 + wx.navigateBack();
  307 + }
  308 + }), !1);
  309 + },
  310 + showInvoice: function() {
  311 + this.setData({
  312 + invoiceToggle: !this.data.invoiceToggle
  313 + });
  314 + },
  315 + keyUpChangePay1: function(t) {
  316 + this.setData({
  317 + payWithUserMoney: !(t.detail.value.length > 0)
  318 + });
  319 + },
  320 + keyUpChangePay2: function(t) {
  321 + this.setData({
  322 + payWithPoints: !(t.detail.value.length > 0)
  323 + });
  324 + },
  325 + keyUpChangeNum: function(t) {
  326 + this.setData({
  327 + maxWord: t.detail.value.length
  328 + });
  329 + },
  330 + //---------计算立即购买----------
  331 + calculatePrice2: function () {
  332 + console.log('calculatePrice2');
  333 + var th = this, good = this.data.bn_goods;
  334 + //-----------计算商品总价--------------
  335 + var allpice = good.shop_price * good.buynum;
  336 + allpice=parseFloat(allpice).toFixed(2);
  337 + var txt = "formData.all_price";
  338 + th.setData({ [txt]: allpice, });
  339 + console.log(th.data.formData);
  340 +
  341 + app.getConfig2(function (ee) {
  342 + app.getwuliuprice(function (rs) {
  343 + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
  344 + //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
  345 + if (th.data.user_addr != null && th.data.bn_exp_type == 0
  346 + && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){
  347 + switch (good['exp_sum_type']) {
  348 + case 1:
  349 + //统一运费
  350 + o_shipping_price += good['uniform_exp_sum']; break;
  351 + case 2:
  352 + if (goods_weight < 0) goods_weight = 0;
  353 + //累积商品重量 每种商品的重量 * 数量
  354 + goods_weight += good['weight'] * good['buynum'];break;
  355 + case 3:
  356 + if (goods_piece < 0) goods_piece = 0;
  357 + //累积商品数量
  358 + goods_piece += good['buynum']; break;
  359 + }
  360 +
  361 + var code = th.data.wu_arr[th.data.index].code;
  362 + var freight_free = ee.freight_free; //全场满多少包邮
  363 + var shipping_price=
  364 + th.calculatewuliu(code, o_shipping_price, goods_weight,
  365 + goods_piece, th.data.user_addr, freight_free, allpice, rs);
  366 +
  367 + shipping_price = parseFloat(shipping_price).toFixed(2);
  368 + var wl_txt = "formData.shipping_price";
  369 + th.setData({ [wl_txt]: shipping_price, })
  370 +
  371 + }else{
  372 + var wl_txt = "formData.shipping_price";
  373 + th.setData({ [wl_txt]: 0, })
  374 + }
  375 + //-----------------总价-----------------
  376 + var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price);
  377 + total_m = parseFloat(total_m).toFixed(2);
  378 +
  379 + var atxt= "formData.total_amount";
  380 + th.setData({ [atxt]: total_m, })
  381 + var order_m = total_m;
  382 +
  383 + var txt = "formData.user_money";
  384 + var txt2 = "formData.order_amount";
  385 + //--------------如果使用余额---------------------
  386 + if (th.data.bn_use_money == 1 && th.data.yuer>0) {
  387 + if ( parseFloat(th.data.yuer) > total_m) {
  388 + th.setData({ [txt]: total_m, [txt2]:0 })
  389 + }else{
  390 + order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
  391 + order_m = order_m.toFixed(2);
  392 + th.setData({ [txt]: th.data.yuer, [txt2]: order_m })
  393 + }
  394 + }else{
  395 + th.setData({ [txt]: 0, [txt2]: order_m })
  396 + }
  397 +
  398 + });
  399 + });
  400 + },
  401 + //--------------------提交订单-----------------------
  402 + submitForm: async function(t){
  403 + if(this.data.is_summit_ing==1) return false; //--提交中退出--
  404 + this.data.is_summit_ing=1;
  405 +
  406 + var th=this,pdata=new Array();
  407 + var ff=true;
  408 + //------------立即购买-------------
  409 +
  410 + //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候
  411 + if(th.data.bn_exp_type == 0 && th.data.user_addr==null && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){
  412 + ff = false;
  413 + getApp().my_warnning("请选择收货地址",0,this);
  414 + this.data.is_summit_ing = 0;
  415 + }
  416 + if (!ff) return false;
  417 + var addr = th.data.user_addr;
  418 + if (th.data.bn_exp_type == 1) addr=null;
  419 +
  420 + if(th.data.bn_exp_type==0 && (th.data.kt_type!=3)) {
  421 + if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
  422 + getApp().my_warnning("读取物流失败",0,this);
  423 + this.data.is_summit_ing = 0;
  424 + return false;
  425 + }
  426 + }
  427 +
  428 + //阶梯团强制带1,自提~~~
  429 + if(th.data.kt_type==3 ){
  430 + th.data.bn_exp_type=1;
  431 + }
  432 +
  433 + var item={
  434 + 'user_id':app.globalData.user_id,
  435 + 'consignee': addr == null ? "" : addr.consignee,
  436 + 'province': addr == null ? 0 : addr.province,
  437 + 'city': addr == null ? 0 : addr.city,
  438 + 'district': addr == null ? 0 : addr.district,
  439 + 'twon': addr == null ? 0 : addr.twon,
  440 + 'address': addr == null ? "": addr.address,
  441 + 'more_address': addr == null ? "" : addr.more_address,
  442 + 'mobile': addr == null ? th.data.userinfo.mobile:addr.mobile,
  443 + 'email':'',
  444 + 'invoice_title':'',
  445 + 'goods_price': th.data.formData.all_price, //商品总价
  446 + 'shipping_price': th.data.formData.shipping_price, //物流金额
  447 + 'user_money': th.data.formData.user_money, //使用余额
  448 + 'total_amount': th.data.formData.total_amount, //订单总价
  449 + 'order_amount': th.data.formData.order_amount, //应付
  450 + 'user_note': t.detail.value.user_note, //用户备注
  451 + 'store_id':os.stoid, //商家
  452 + 'pickup_id': th.data.bn_pick, //门店
  453 + 'prom_type':th.data.bn_goods.prom_type, //促销活动类型
  454 + 'prom_id': th.data.bn_goods.prom_id, //促销活动id
  455 + 'order_goods':new Array(),
  456 + };
  457 +
  458 + //老会员成为分销下线需要的参数
  459 + if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){
  460 + //判断一下分享人是不是分享商
  461 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{
  462 + if(res.data.code==0){
  463 + var user= res.data.data;
  464 + if(user.is_distribut==1){
  465 + item.first_leader=parseInt(getApp().globalData.first_leader);
  466 + }
  467 + }
  468 + })
  469 + }
  470 +
  471 + if(th.data.qh!='')
  472 + {
  473 + item.team_qh=th.data.qh;
  474 + item.pt_listno=th.data.qh;
  475 + }
  476 +
  477 + var gg =app.get_b_now();
  478 + var goods={
  479 + 'goods_id': gg.goods_id,
  480 + 'goods_name': gg.goods_name,
  481 + 'goods_sn': gg.goods_sn,
  482 + 'goods_num': gg.goods_num,
  483 + 'market_price': th.data.bn_goods.market_price,
  484 + 'goods_price': th.data.bn_goods.shop_price,
  485 + 'member_goods_price': th.data.bn_goods.shop_price,
  486 + 'store_id': os.stoid,
  487 + 'prom_type':th.data.bn_goods.prom_type, //促销活动类型
  488 + 'prom_id': th.data.bn_goods.prom_id, //促销活动id
  489 + };
  490 +
  491 + //--导购分享过来的id--
  492 + if(gg.guide_id){
  493 + goods.guide_id=gg.guide_id;
  494 + goods.guide_type=gg.guide_type;
  495 + //调用接口判断是不是会员
  496 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+os.stoid+"/"+gg.guide_id,{}).then(res=>{
  497 + if(res.data.code==0){
  498 + goods.guide_name=res.data.data.salesman;
  499 + goods.guide_sn=res.data.data.salesman_no;
  500 + }
  501 + })
  502 + }
  503 +
  504 + //--商品的房间号--
  505 + if(gg.room_id && gg.room_id>0){
  506 + item.room_ids=gg.room_id;
  507 + goods.room_id=gg.room_id;
  508 + }
  509 +
  510 + if(th.data.bn_goods.is_normal){goods.is_pd_normal=1;}
  511 +
  512 + item.order_goods.push(goods);
  513 + pdata.push(item);
  514 +
  515 + if (pdata.length==0) return;
  516 + var str = JSON.stringify(pdata);
  517 + wx.showLoading({title: "加载中"});
  518 + wx.request({
  519 + url: os.url + '/api/weshop/order/createWxdOrder',
  520 + data: str,
  521 + method: 'POST',
  522 + header: {
  523 + 'content-type': 'application/json'
  524 + },// 设置请求的 header
  525 + success: function (res) {
  526 +
  527 + wx.hideLoading();
  528 + if (res.statusCode == 200) {
  529 + var data=res.data;
  530 + if(data.code==0){
  531 + console.log(th.data.is_b_now);
  532 + //如果是购物车结算,还要删除购物车
  533 + if (th.data.is_b_now == 0) {
  534 + console.log(th.data.cartlist_y);
  535 + var list = th.data.cartlist_y;
  536 + for (var i = 0; i < list.length; i++) {
  537 + //删除购物车
  538 + getApp().request.delete("/api/weshop/cart/del/" + os.stoid + "/" + list[i].id, {});
  539 + }
  540 + }
  541 + var order_amount = 0;
  542 + pdata.forEach(function (em, ind) {
  543 + order_amount += em.order_amount;
  544 + })
  545 + //要进行判断,如果是用微信支付,就要跳转到支付界面
  546 + if (order_amount > 0) {
  547 + th.setData({ isclose: 0 });
  548 + //void e.jumpToCart4({
  549 + // order_sn: data.data,
  550 + // type:1,
  551 + // }, 1);
  552 + util_pay.pay(data.data, function() {
  553 + setTimeout(function () {
  554 + wx.reLaunch({
  555 + //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,
  556 + url: "/pages/team/team_success/team_success?ordersn=" + data.data,
  557 + })
  558 + },1000)
  559 + }, function () {
  560 + //支付失败
  561 + setTimeout(function () {
  562 + //wx.navigateBack({ delta: 1 })
  563 + wx.reLaunch({
  564 + url: "/pages/user/order_list/order_list",
  565 + })
  566 + },1000)
  567 +
  568 + },os.stoid,1);
  569 +
  570 + } else {
  571 + var dd = {
  572 + parent_sn: data.data,
  573 + store_id: os.stoid,
  574 + type: 1,
  575 + };
  576 + //return false;
  577 + getApp().request.post("/api/weshop/order/pay/createOrder", {
  578 + data: dd,
  579 + success: function (t) {
  580 + console.log(t);
  581 + app.my_warnning("支付成功",1,th);
  582 + setTimeout(function () {
  583 + th.setData({ isclose: 0 });
  584 +
  585 + if(th.data.is_normal==1){
  586 + /*--
  587 + wx.navigateTo({
  588 + url: "/pages/user/order_list/order_list",
  589 + })--*/
  590 + var url="/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data;
  591 + wx.reLaunch({
  592 + url: url
  593 + })
  594 +
  595 + }else{
  596 + wx.reLaunch({
  597 + url: "/pages/team/team_success/team_success?ordersn=" + data.data,
  598 + })
  599 + }
  600 +
  601 + }, 1000)
  602 + }
  603 + });
  604 + }
  605 + }
  606 + else{
  607 + th.data.is_summit_ing=0; //是否提交中
  608 + getApp().confirmBox(data.msg);
  609 + }
  610 + } else {
  611 + th.data.is_summit_ing=0; //是否提交中
  612 + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
  613 + }
  614 + },
  615 + fail: function () {
  616 + th.data.is_summit_ing=0; //是否提交中
  617 + wx.hideLoading();
  618 + console.log("index.js wx.request CheckCallUser fail");
  619 + },
  620 + complete: function () {}
  621 + })
  622 + },
  623 + useCoupon: function() {
  624 + if (this.data.order.couponNum <= 0) {
  625 + //return t.showWarning("无可用优惠券");
  626 + getApp().my_warnning("无可用优惠券",0,this);
  627 + return;
  628 + }
  629 + var a = {
  630 + lid: this.data.coupon ? this.data.coupon.id : "0"
  631 + };
  632 + wx.navigateTo({
  633 + url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)
  634 + });
  635 + },
  636 + enterAddressPage: function() {
  637 + getApp().globalData.is_cart_old=1;
  638 + this.data.enterAddressPage = !0, wx.navigateTo({
  639 + url: "/pages/user/address_list/address_list"
  640 + });
  641 + },
  642 +
  643 + //--------立即购买时,选择自提和物流-----------
  644 + setexptype_w:function(t){
  645 + var th=this;
  646 + var ty = t.currentTarget.dataset.t,txt = t.currentTarget.dataset.txt;
  647 + th.setData({ [txt]: ty });
  648 + var iszt=1;
  649 + if(ty==0){
  650 + th.setData({ is_all_zt: 0 });
  651 + }else{
  652 + for(var i=0;i<th.data.cartlist.length;i++){
  653 + var item = th.data.cartlist[i];
  654 + if (item.exp_type==0){ iszt=0;break;}
  655 + }
  656 + th.setData({ is_all_zt: iszt });
  657 + }
  658 + //----计算此时购物车的价格----
  659 + th.calculatePrice();
  660 + },
  661 +
  662 + //--------立即购买时,选择自提和物流----------
  663 + setexptype:function(t){
  664 + var th=this;
  665 + var ty = t.currentTarget.dataset.t;
  666 + th.setData({ bn_exp_type:ty});
  667 + //当物流为空的时候。
  668 + if (ty == 0 && th.data.wu_arr==null){
  669 + return th.get_wuliu(th.calculatePrice2());
  670 + }
  671 + th.calculatePrice2()
  672 + console.log('setexptype');
  673 + },
  674 +
  675 + //--------立即购买时,使用余额--------
  676 + set_bn_useyuer:function(){
  677 + var th=this;
  678 + th.setData({ bn_use_money: !th.data.bn_use_money});
  679 + th.calculatePrice2();
  680 + },
  681 + set_js_useyuer:function(){
  682 + var th = this;
  683 + th.setData({ js_use_money: !th.data.js_use_money });
  684 + th.calculatePrice();
  685 + },
  686 +
  687 + //-------------------计算物流---------------
  688 + calculatewuliu:function(code, o_shipping_price, goods_weight,
  689 + goods_piece,user_addr, freight_free, o_price, rs){
  690 + var price =0,th=this;
  691 + price +=parseFloat(o_shipping_price);
  692 + //如果是包邮
  693 + if (freight_free > 0 && o_price > freight_free){ return 0;}
  694 + if (user_addr==null) { return 0; }
  695 + //计算物流的config item;
  696 + var item=null;
  697 + //先根据 镇 县 区找计算的config
  698 + item = th.get_wuliu_config(user_addr.district,code,rs);
  699 + if (item==null) item = th.get_wuliu_config(user_addr.city, code, rs);
  700 + if (item==null) item = th.get_wuliu_config(user_addr.province, code, rs);
  701 + if (item == null) item = th.get_wuliu_default(code,rs);
  702 + if (item == null) return o_shipping_price;
  703 + var fw_price = 0, fp_price=0;
  704 + item=item.config;
  705 + if (item == null) return o_shipping_price;
  706 + //------按重量----------
  707 + if (goods_weight>0) {
  708 + fw_price =parseFloat(item['money']);
  709 + if (goods_weight > item['first_weight']){
  710 + var fw = goods_weight - item['first_weight'];
  711 + var n = Math.ceil(fw/item['second_weight'])
  712 + fw_price = fw_price + n * parseFloat(item['add_money']);
  713 + }
  714 + }
  715 + //------按件数----------
  716 + if (goods_piece > 0) {
  717 + fp_price = parseFloat(item['piecemoney']);
  718 + if (goods_piece > item['first_piece']) {
  719 + var fp = goods_piece - item['first_piece'];
  720 + var m = Math.ceil(fp / item['second_piece'])
  721 + fp_price = fp_price + m * parseFloat(item['add_piecemoney']);
  722 + }
  723 + }
  724 + var rspice =parseFloat(price + fw_price + fp_price);
  725 + return rspice;
  726 + },
  727 +
  728 + //------------循环获取config-----------
  729 + get_wuliu_config:function(region_id,code,rs){
  730 + var item=null,rslist = rs.pageData;
  731 + for (var i = 0; i < rslist.length;i++){
  732 + if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];}
  733 + }
  734 + return item;
  735 + },
  736 + //-------循环获取config,code default-------
  737 + get_wuliu_default: function (code, rs) {
  738 + var item = null, rslist=rs.pageData;
  739 + for (var i = 0; i < rslist.length; i++) {
  740 + if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }
  741 + }
  742 + return item;
  743 + },
  744 +
  745 + //----------立即购买,选择物流-------------
  746 + bindPickerChange:function(e){
  747 + var ind = e.detail.value
  748 + this.setData({ index: ind });
  749 + this.calculatePrice2();
  750 + },
  751 +
  752 + //----------购物车结算,选择物流-------------
  753 + bindPickerChange_w: function (e) {
  754 + var ind=e.detail.value, txt = e.currentTarget.dataset.txt;
  755 + this.setData({ [txt]: ind });
  756 + this.calculatePrice();
  757 + },
  758 +
  759 + cart_set_err: function (e) {
  760 + var txt = e.currentTarget.dataset.err;
  761 + var ob = {};
  762 + ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";
  763 + this.setData(ob);
  764 + },
  765 +
  766 + //// 开启物流的弹窗
  767 + show_wu_arr:function(e){
  768 + this.setData({ open_express: 1});
  769 + },
  770 +
  771 + //更新下默认,在onshow里面
  772 + update_code(){
  773 + var th=this,m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;
  774 +
  775 + var uii=setInterval(function () {
  776 + if(th.data.wu_arr){
  777 + clearInterval(uii);
  778 + for (var k = 0; k < th.data.wu_arr.length; k++) {
  779 + var item = th.data.wu_arr[k];
  780 + if (def_exp_code == item.code) {
  781 + m_wind = k;
  782 + }
  783 + }
  784 + //--如果是立即购买--
  785 + th.setData({ index: m_wind, is_express: m_wind});
  786 + }
  787 + },500)
  788 + },
  789 +
  790 + // 关闭物流的弹窗
  791 + close_express:function(){
  792 + this.setData({ open_express:0 });
  793 + },
  794 + // 选择物流
  795 + click_express_name:function(e){
  796 + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
  797 + var index=e.currentTarget.dataset.idxe;
  798 + var ob={ is_express: index, is_shipping_code: shippingcode,index:index};
  799 + this.setData(ob);
  800 + },
  801 +
  802 + //点击确定物流
  803 + determine_expres:function(e){
  804 + this.setData({ open_express: 0});
  805 + this.calculatePrice2();
  806 + },
  807 + //设置默认物流
  808 + select_default_logistics: function () {
  809 + var th=this;
  810 + var is_shipping_code=this.data.is_shipping_code
  811 + getApp().request.put("/api/weshop/users/update",{
  812 + data: { user_id: getApp().globalData.user_id, store_id: os.stoid, def_exp_code: is_shipping_code},
  813 + success:function(rse){
  814 + if (rse.data.code==0){
  815 + getApp().globalData.userInfo.def_exp_code=is_shipping_code;
  816 + th.setData({ open_express: 0 });
  817 + //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19----
  818 + //if(th.data.is_b_now==1) th.calculatePrice2();
  819 + //else th.calculatePrice();
  820 + th.calculatePrice2();
  821 + }
  822 + }
  823 + })
  824 + },
  825 +
  826 +
  827 + //跳转到购买卡
  828 + buycard:function(){
  829 + getApp().goto("/pages/user/plus/plus");
  830 + getApp().globalData.plus_buy_back=1;
  831 + }
  832 +});
packageC/pages/presell/cart/cart2_pre.json 0 → 100644
  1 +{
  2 + "navigationBarTitleText": "填写订单",
  3 + "enablePullDownRefresh": false,
  4 + "usingComponents": {
  5 + "warn": "/components/long_warn/long_warn"
  6 + }
  7 +}
0 \ No newline at end of file 8 \ No newline at end of file
packageC/pages/presell/cart/cart2_pre.wxml 0 → 100644
  1 +<wxs module="filters" src="../../../utils/filter.wxs"></wxs>
  2 +<form bindsubmit="submitForm">
  3 + <view class="container">
  4 + <view class="tab-container" wx:if="{{act.presell_type==1}}">
  5 + <view class="tab-wrapper">
  6 + <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}"
  7 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
  8 +
  9 + <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}"
  10 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view>
  11 +
  12 + </view>
  13 + </view>
  14 +
  15 + <block wx:if="{{act.presell_type==1}}">
  16 + <!--要进行判断地址是否显示---->
  17 + <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{bn_exp_type==0}}'>
  18 + <!---默认地址显示------>
  19 + <block wx:if="{{user_addr!=null}}">
  20 + <view class="user-contact">收货人:{{user_addr.consignee}}{{'  '}}{{user_addr.mobile}}</view>
  21 + <view class="location">
  22 + <view class="address">{{user_addr.more_address}}{{' '}}{{user_addr.address}}</view>
  23 + <view class="pos-icon">
  24 + <image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/goodscategory/new_position.png"></image>
  25 + </view>
  26 + </view>
  27 + <view class="update-logistics">
  28 + <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/icon-arrowdown.png"></image>
  29 + </view>
  30 + </block>
  31 + <!---先增地址------>
  32 + <block wx:else>
  33 + <view class="add_new">
  34 + <image class="addr_jia" src="{{imgUrl}}/miniapp/images/jia.png"></image>添加地址
  35 + </view>
  36 + </block>
  37 + <!-- <view class="border-img"><image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/tt.png"></image></view> -->
  38 + </view>
  39 + </block>
  40 +
  41 + <!------立即购买-------->
  42 + <block>
  43 + <!-- <view class="xc-border main-top"></view> -->
  44 + <view class="use-item bfff bdr_t-14 mgt20">
  45 + <image class="dp" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'> </image> <view>{{bn_pickname}}</view></view>
  46 + <view class="order-detail">
  47 + <view class="goods-img">
  48 + <image class="wh100 bdr14" src="{{bn_goods.original_img}}"
  49 + binderror='cart_set_err' data-err="bn_goods.original_img"></image>
  50 + </view>
  51 + <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{bn_goods.goods_id}}">
  52 + <view class="goods-name ellipsis-2">{{bn_goods.goods_name}}</view>
  53 + <!-- 商品属性 -->
  54 + <view class="flex-vertical fs28 color-gray n_guige">
  55 + <view class="goods-color"><text>{{filters.show_gui_ge(bn_goods.goods_spec,bn_goods.goods_color)}}</text>
  56 + </view></view>
  57 +
  58 + <!-----商品名称规格------>
  59 + <view class="order-num flex-space-between">
  60 + <view class="co-red">¥<text class="fs36">{{filters.toFix(bn_goods.shop_price,2)}}</text></view>
  61 + <view class="goods-num">x{{bn_goods.buynum}}</view>
  62 + </view>
  63 + </navigator>
  64 + <!-- <view class="order-num">
  65 + <view class="co-red">¥{{bn_goods.shop_price}}</view>
  66 + <view class="goods-num">x{{bn_goods.buynum}}</view>
  67 + </view> -->
  68 + </view>
  69 +
  70 + <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 -->
  71 + <view class="plus_buy fs28" wx:if="{{card_cut_price>0}}">
  72 + <view class="flex">
  73 + <view class="card_bg ellipsis-1" style="margin-right: 10rpx;">
  74 + <image src="{{imgUrl}}/miniapp/images/plus/dj_icon.png"></ image>
  75 + <text class="card_name">{{show_card.CardName}}</text>
  76 + </view>
  77 + <view>立减 <text style="color:#f23030;">{{filters.toFix(card_cut_price,2) }}</text> 元</view>
  78 + </view>
  79 + <view>
  80 + <text style="color: #999;margin-left: 4rpx;">vip超级会员仅需{{show_card.CardFee}}元</text>
  81 + </view>
  82 + <!-- 三角形 -->
  83 + <view class="car_tri_up"></view>
  84 + <!-- 立即开通跳转 -->
  85 + <view bindtap="buycard" class="card_op">立即开通</view>
  86 + </view>
  87 +
  88 +
  89 + <view class="set-mes bdr_b-14">
  90 + <view wx:if="{{order.store_prom}}"><icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}}
  91 + </view>
  92 +
  93 + <!--阶梯团是不显示的-->
  94 + <block wx:if="{{bn_exp_type==0 && !is_default_logistics}}">
  95 + <view class="use-item flex-space-between" wx:if="{{kt_type!=3 || is_normal==1}}">
  96 + <view>选择物流</view>
  97 + <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;">
  98 + <view class="logistics-name">{{wu_arr[index].name}}</view><view class="xc-right"></view>
  99 + </view>
  100 + </view>
  101 + </block>
  102 +
  103 + <!--阶梯团是不显示的
  104 + <block wx:if="{{kt_type!=3 || is_normal==1 }}">
  105 + <view class="use-item" hidden='{{bn_exp_type==1}}'>
  106 + <view>使用物流:</view>
  107 + <picker bindchange="bindPickerChange" value="{{index}}" range="{{wu_arr}}" range-key="name">
  108 + <view >{{wu_arr[index].name}}</view>
  109 + </picker>
  110 + </view>
  111 + </block>-->
  112 +
  113 + </view>
  114 +
  115 +
  116 + <view class="coupon-mes flex-vertical">
  117 + <view>留言</view>
  118 + <view class="leave-word">
  119 + <input placeholder-class="fs28" placeholder='给商家留言,最多100字'bindinput="keyUpChangeNum" disabled="{{disabled}}" class="word-box" maxlength="100" name="user_note"></input>
  120 +
  121 + </view>
  122 + </view>
  123 + </block>
  124 +
  125 + <view class="information bdr14">
  126 + <!-----使用余额------>
  127 + <view class="set-mes" wx:if="{{userinfo.user_money>0 && yuer>0}}">
  128 + <view class="use-item" bindtap='set_bn_useyuer' style="padding-left:0;padding-right:0;">
  129 + <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon>
  130 + <view class="yu_er">使用余额 :¥{{yuer}} </view>
  131 + </view>
  132 + </view>
  133 + <view class="item" wx:if="{{kt_type<3 || is_normal==1}}">
  134 + <view>商品金额</view>
  135 + <view class="co-red">¥ {{formData.all_price}}元</view>
  136 + </view>
  137 +
  138 + <view class="item" wx:else>
  139 + <view>定金金额</view>
  140 + <view class="co-red">¥ {{formData.all_price}}元</view>
  141 + </view>
  142 +
  143 + <view class="item" wx:if="{{formData.shipping_price>0}}">
  144 + <view>配送费用</view>
  145 + <view class="co-red">¥ {{formData.shipping_price}}元</view>
  146 + </view>
  147 + <view class="item" wx:if="{{formData.user_money>0}}">
  148 + <view>使用余额</view>
  149 + <view class="co-red">- ¥ {{formData.user_money}}元</view>
  150 + </view>
  151 +
  152 + </view>
  153 + </view>
  154 +
  155 + <view class="btn-wrap">
  156 + <view class="pay-amount">
  157 + <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view>
  158 + <!-- <view class="co-red big"></view> -->
  159 + </view>
  160 + <button class="tips-btn" formType="submit" id="submitOrder">提交订单</button>
  161 + </view>
  162 +</form>
  163 +
  164 +<!----弹起选择物流名的列表---->
  165 +<view wx:if='{{open_express==1}}' >
  166 + <view class="cover-layer flex-center " bindtap='close_express'>
  167 + </view>
  168 +
  169 + <view class="cx-popup radius {{open_express==1?'up' : 'down'}}" >
  170 + <view class="tops flex">
  171 + <view class="top-content fs32">
  172 + <view>
  173 + 选择物流名字
  174 + </view>
  175 + </view>
  176 + <view class="close-frame" bindtap='close_express' >
  177 + <view class="xc-close-express">×</view>
  178 + </view>
  179 + </view>
  180 + <view class="express_list">
  181 + <view wx:for="{{wu_arr}}" wx:for-item="express_list" wx:for-index="idx">
  182 + <view class="express_list_frame" bindtap="click_express_name"
  183 + data-shippingcode="{{express_list.shipping_code}}"
  184 + data-name="{{express_list.name}}" data-idxe="{{idx}}">
  185 +
  186 + <block wx:if="{{is_express==idx}}">
  187 + <view class="circle white xc-hook fs20 red-b"><text>Γ</text></view>
  188 + </block>
  189 + <block wx:else>
  190 + <view class="circle xc-hooks"></view>
  191 + </block>
  192 + <view class="fs30">{{express_list.name}}</view>
  193 +
  194 + </view>
  195 + </view>
  196 + </view>
  197 + <view class="flex click-buttem" >
  198 + <view class="xc-determine flex-center" bindtap="determine_expres">
  199 + <view class="flex-vertical t-c">确定</view>
  200 + </view>
  201 + <view class="xc-confirms flex-center" bindtap="select_default_logistics">
  202 + <view class="flex-vertical t-c">设为默认</view>
  203 + </view>
  204 + </view>
  205 +
  206 + </view >
  207 +</view>
  208 +
  209 +<warn id="warn"></warn>
packageC/pages/presell/cart/cart2_pre.wxss 0 → 100644
  1 +.bdr_t-14 {
  2 + border-top-left-radius: 14rpx;
  3 + border-top-right-radius: 14rpx;
  4 +}
  5 +.bdr_b-14 {
  6 + border-bottom-left-radius: 14rpx;
  7 + border-bottom-right-radius: 14rpx;
  8 +}
  9 +.bdr14 {
  10 + border-radius: 14rpx;
  11 +}
  12 +.mgt20 {
  13 + margin-top: 20rpx;
  14 +}
  15 +.shadow {
  16 + box-shadow: 0 4rpx 12px #e7e9eb;
  17 +}
  18 +.shadow-1 {
  19 + box-shadow: 16rpx 0px 12px #e7e9eb;
  20 +}
  21 +
  22 +
  23 +page {
  24 + /* background-color: #FAFAFA; */
  25 + background-color: #F0F0F0;
  26 + padding: 0 22rpx;
  27 + box-sizing: border-box;
  28 +}
  29 +.container {
  30 + background-color: #F0F0F0;
  31 + /* padding-top: 28rpx; */
  32 + padding-bottom: 120rpx;
  33 +}
  34 +.user-mes {
  35 + position: relative;
  36 + background-color: #fff;
  37 + font-size: 32rpx;
  38 + color: #444;
  39 + /* margin-top: 28rpx; */
  40 + border-radius: 14rpx;
  41 +}
  42 +.user-contact {
  43 + padding: 24rpx 26rpx;
  44 + font-weight: 600;
  45 +}
  46 +
  47 +.location {
  48 + position: relative;
  49 + padding: 0 70rpx 24rpx;
  50 +}
  51 +
  52 +.pos-icon {
  53 + position: absolute;
  54 + left: 28rpx;
  55 + top: 6rpx;
  56 + width: 30rpx;
  57 + height: 36rpx;
  58 +}
  59 +
  60 +.border-img {
  61 + width: 100%;
  62 + height: 12rpx;
  63 +}
  64 +
  65 +.update-logistics {
  66 + position: absolute;
  67 + right: 0;
  68 + top: 0;
  69 + width: 80rpx;
  70 + height: 100%;
  71 + display: flex;
  72 + align-items: center;
  73 + justify-content: center;
  74 +}
  75 +
  76 +.arrow-rigth {
  77 + width: 32rpx;
  78 + height: 32rpx;
  79 +}
  80 +
  81 +.order-meg {
  82 + margin-bottom: 20rpx;
  83 + font-size: 28rpx;
  84 +
  85 +}
  86 +
  87 +.order-detail {
  88 + padding: 30rpx 0;
  89 + border-bottom: 2rpx solid #eee;
  90 + color: #777;
  91 + min-height: 190rpx;
  92 + background-color: #fff;
  93 +
  94 +}
  95 +
  96 +.goods-img {
  97 + float: left;
  98 + width: 200rpx;
  99 + height: 200rpx;
  100 + margin: 0 20rpx;
  101 +}
  102 +
  103 +.order-cont {
  104 + float: left;
  105 + width: 438rpx;
  106 +}
  107 +
  108 +.goods-name {
  109 + height: 74rpx;
  110 + line-height: 40rpx;
  111 + overflow: hidden;
  112 + margin-bottom: 16rpx;
  113 + font-size: 28rpx;
  114 + color: #333;
  115 +
  116 +}
  117 +
  118 +.goods-color {
  119 + font-size: 24rpx;
  120 +}
  121 +
  122 +.order-num {
  123 + margin-top: 25rpx;
  124 + font-size: 24rpx;
  125 + line-height: 42rpx;
  126 +}
  127 +
  128 +.set-mes{
  129 + background-color: #fff;
  130 + /* margin-top: 20rpx; */
  131 +}
  132 +.use-item{
  133 + display: flex;
  134 + align-items: center;
  135 + height: 80rpx;
  136 + /* border-bottom: 1px solid #ddd; */
  137 + font-size: 30rpx;
  138 + /* width:95%;
  139 +margin:auto; */
  140 + padding: 0 26rpx;
  141 +}
  142 +.use-item>view{
  143 + display: flex;
  144 + /* margin-right: 12rpx; */
  145 +}
  146 +.use-item.bfff{
  147 + background-color: #fff;
  148 +}
  149 +.use-item .dp{
  150 + display: block;
  151 + width: 50rpx;
  152 + height: 50rpx;
  153 + margin-left: -6rpx;
  154 +}
  155 +
  156 +.set-item {
  157 + justify-content: space-between;
  158 + background-color: #fff;
  159 +}
  160 +
  161 +.set-btn {
  162 + display: flex;
  163 + font-size: 24rpx;
  164 +}
  165 +
  166 +.set-mes input {
  167 + width: 380rpx;
  168 + height: 50rpx;
  169 + line-height: 50rpx;
  170 + border: 1px solid #ddd;
  171 +}
  172 +
  173 +.use-btn {
  174 + width: 100rpx;
  175 + height: 50rpx;
  176 + margin-left: 20rpx;
  177 + line-height: 50rpx;
  178 + text-align: center;
  179 + background-color: #f23030;
  180 + color: #fff;
  181 +}
  182 +
  183 +.coupon-mes {
  184 + /* box-sizing: border-box; */
  185 + height:95rpx;
  186 + padding: 0 26rpx;
  187 + background-color: #fff;
  188 + font-size: 30rpx;
  189 + color: #444;
  190 + /* width: 100%; */
  191 + border-radius: 14rpx;
  192 + margin-top: 20rpx;
  193 + margin-bottom: 20rpx;
  194 +}
  195 +
  196 +.coupon-title {
  197 + display: flex;
  198 + justify-content: space-between;
  199 + align-items: center;
  200 + height: 92rpx;
  201 +}
  202 +
  203 +.coupon-title>view {
  204 + display: flex;
  205 +}
  206 +
  207 +.coupon-num {
  208 + height: 36rpx;
  209 + margin-left: 20rpx;
  210 + padding: 0 16rpx;
  211 + line-height: 36rpx;
  212 + text-align: center;
  213 + background-color: #f23030;
  214 + color: #fff;
  215 + font-size: 24rpx;
  216 +}
  217 +
  218 +.leave-word {
  219 + position: relative;
  220 + font-size: 24rpx;
  221 + margin-left: 20rpx;
  222 + flex-grow: 1;
  223 +}
  224 +
  225 +.word-box {
  226 + font-size: 26rpx;
  227 + /* width: 600rpx; */
  228 + padding: 10rpx;
  229 + height: 28rpx;
  230 + line-height: 40rpx;
  231 +}
  232 +
  233 +.max-word {
  234 + position: absolute;
  235 + right: 0;
  236 + bottom: 0;
  237 +}
  238 +
  239 +.information {
  240 + padding: 0 26rpx;
  241 + background-color: #fff;
  242 + /* margin-bottom: 120rpx; */
  243 +}
  244 +
  245 +.information .item {
  246 + display: flex;
  247 + justify-content: space-between;
  248 + height: 60rpx;
  249 + line-height: 60rpx;
  250 + font-size: 26rpx;
  251 + color: #777;
  252 +}
  253 +
  254 +.btn-wrap {
  255 + height: 94rpx;
  256 + box-sizing: border-box;
  257 + display: flex;
  258 + justify-content: space-between;
  259 + background-color: white;
  260 + align-items: center;
  261 + position: fixed;
  262 + bottom: 0;
  263 + left: 0;
  264 + width: 100%;
  265 + padding: 0 30rpx;
  266 +}
  267 +
  268 +.tips-btn {
  269 + /* float: right;
  270 + width: 200rpx;
  271 + height: 100rpx;
  272 + line-height: 100rpx;
  273 + text-align: center;
  274 + font-size: 30rpx;
  275 + color: #fff;
  276 + background-color: #f23030; */
  277 + color: white;
  278 + background-color: #FE4445;
  279 + height: 72rpx;
  280 + line-height: 72rpx;
  281 + padding: 0 42rpx;
  282 + border-radius: 36rpx;
  283 + margin-left: 0;
  284 + margin-right: 0;
  285 +}
  286 +
  287 +.pay-amount {
  288 + /* float: right;
  289 + display: flex;
  290 + align-items: center;
  291 + height: 100rpx;
  292 + font-size: 26rpx;
  293 + margin-right: 40rpx; */
  294 +}
  295 +
  296 +.payable {
  297 + color: #444;
  298 + /* margin-right: 20rpx; */
  299 +}
  300 +
  301 +.shipping-modal {
  302 + z-index: 20;
  303 + position: fixed;
  304 + bottom: 0;
  305 + left: 0;
  306 + right: 0;
  307 + overflow-y: hidden;
  308 + color: #666666;
  309 + background-color: white;
  310 +}
  311 +
  312 +.shipping-nav {
  313 + text-align: center;
  314 + font-size: 35rpx;
  315 + padding-top: 30rpx;
  316 +}
  317 +
  318 +.shipping-list {
  319 + padding: 20rpx 30rpx 40rpx;
  320 + font-size: 28rpx;
  321 +}
  322 +
  323 +.shipping-item {
  324 + display: block;
  325 + padding: 20rpx 0;
  326 +}
  327 +
  328 +.shipping-btn {
  329 + width: 100%;
  330 + color: white;
  331 + background-color: #f23030;
  332 + line-height: 90rpx;
  333 + text-align: center;
  334 + font-size: 40rpx;
  335 +}
  336 +
  337 +/*----------nyf新增,地址---------*/
  338 +.add_new{
  339 + height: 90rpx;
  340 + display: flex;
  341 + align-items: center;
  342 + padding: 0 26rpx;
  343 +}
  344 +.addr_jia{width: 45rpx; height: 45rpx; border: 1rpx solid #ddd;
  345 + margin-right: 15rpx;vertical-align: middle;}
  346 +.yu_er{
  347 + margin-left: 10rpx;
  348 + /* margin-right: 60rpx; */
  349 +}
  350 +.wuliu{margin-left: 20rpx;}
  351 +
  352 +
  353 +/*---- 优惠券列表 -----*/
  354 +.xc-coupon-frame{
  355 + width: 100%;
  356 + height: 92rpx;
  357 +
  358 +}
  359 +.xc-coupon-frame .work-frame{
  360 + width: 100%;
  361 + height: 100%;
  362 + border-bottom:3rpx solid #eee;
  363 + padding: 0 26rpx;
  364 + background-color: white;
  365 +}
  366 +.xc-right{
  367 + width:20rpx;
  368 + height:20rpx;
  369 + border-top:2rpx solid #000;
  370 + border-right:2rpx solid #000;
  371 + transform:rotate(45deg);
  372 + display:inline-block;
  373 +}
  374 +
  375 +.xc-coupon-frame .work-frame .work{ font-size: 30rpx; line-height: 92rpx; }
  376 +.xc-right-frame{font-size: 30rpx;line-height: 92rpx; margin-right: 10rpx }
  377 +
  378 +/* 自定义弹出窗口 */
  379 +.cx-popup{
  380 + width:100%;
  381 + height:880rpx;
  382 + background: #fff;
  383 + z-index: 35;
  384 + border-top-left-radius: 20rpx;
  385 + border-top-right-radius: 20rpx;
  386 + position:fixed;
  387 + bottom:0;
  388 + left: 0;
  389 + /* padding-bottom: 25rpx; */
  390 +}
  391 +
  392 +.cx-popup .top{
  393 + width:95%;
  394 + height:100rpx;
  395 + border-bottom:3rpx solid #ddd;
  396 + margin: auto;
  397 + margin-top: 30rpx;
  398 +
  399 +}
  400 +.xc-top-content{
  401 + width: 93%;
  402 + height:85rpx;
  403 + padding-top: 30rpx;
  404 + font-size: 34rpx;
  405 + font-weight: 600;
  406 +
  407 +}
  408 +
  409 +
  410 +.xc-valid-coupon{
  411 + width: 90%;
  412 + height:40rpx;
  413 + padding-top: 24rpx;
  414 + overflow: hidden;
  415 +}
  416 +.xc-frame{
  417 + width: 100%;
  418 + height:60%;
  419 +}
  420 +
  421 +.xc-frame .list-frame{
  422 + width: 95%;
  423 + height: 100%;
  424 + overflow-y:scroll;
  425 +
  426 +}
  427 +.xc-close-frame{
  428 + margin-top:-10rpx;
  429 +
  430 +}
  431 +
  432 +.xc-close{
  433 + width: 37rpx;
  434 +height: 37rpx;
  435 +border-radius: 50%;
  436 +border: 3rpx solid #333;
  437 +text-align: center;
  438 +line-height: 34rpx;
  439 +font-size: 29rpx;
  440 +color: #333;
  441 +
  442 +}
  443 +.xc-money{
  444 + color: #af2346;
  445 + font-size: 35rpx;
  446 +}
  447 +
  448 +.xc-money-frame{
  449 + margin-left:35rpx;
  450 +
  451 +}
  452 +.xc-coupon-effect{
  453 + width: 99%;
  454 + min-height: 100rpx;
  455 + border-bottom:3rpx solid #ddd;
  456 +
  457 +
  458 +}
  459 +.xc-goods-coupon{
  460 + width: 85%;
  461 + height:100%;
  462 +
  463 +}
  464 +.xc-title{
  465 + width:50%;
  466 + margin-left:222rpx;
  467 +
  468 +}
  469 +.xc-coupon-money0{
  470 + color: #c91e31;
  471 + font-size: 35rpx;
  472 + line-height: 40rpx;
  473 +
  474 +}
  475 +.xc-coupon-money{
  476 + color: #c91e31;
  477 + font-size: 35rpx;
  478 + line-height: 40rpx;
  479 + padding-top: 10px;
  480 +
  481 +}
  482 +.xc-coupon-money1{
  483 + color: #444;
  484 + font-size: 28rpx;
  485 + line-height: 60rpx;
  486 +
  487 +
  488 +}
  489 +.xc-coupon-time{
  490 + height: 50rpx;
  491 + font-size: 27rpx;
  492 + color: #a4a4a4;
  493 +}
  494 +.xc-coupon-time .time{
  495 + margin-left: 15rpx;
  496 + font-size: 27rpx;
  497 +}
  498 +.xc-coupon-selection{
  499 + height:100%;
  500 +}
  501 +
  502 +.xc-confirm {
  503 + width: 50%;
  504 + border-radius: 50rpx;
  505 + height: 80rpx;
  506 + margin:0 auto;
  507 + background:#d60021;
  508 + color:#fff;
  509 + font-size:28rpx;
  510 + margin-top: 28rpx;
  511 +}
  512 +
  513 +.up{ animation: up .7s; }
  514 +.down{ animation: down 1s; }
  515 +@keyframes up { 0% { transform: translateY(550rpx); } 100% { transform: translateY(0); } }
  516 +@keyframes down { 0% { transform: translateY(0); } 100% { transform: translateY(550rpx); } }
  517 +
  518 +.xc-not-Selection{
  519 + width: 40rpx;
  520 +height: 40rpx;
  521 + background: #eeeeee;
  522 +}
  523 +
  524 +
  525 +.xc-close-express{
  526 + width: 40rpx;
  527 +height: 40rpx;
  528 +border-radius: 50%;
  529 +border: 3rpx solid #333;
  530 +text-align: center;
  531 +font-size:32rpx;
  532 +line-height: 38rpx;
  533 +color: #333;
  534 +margin-top: 5rpx;
  535 +}
  536 +.cx-popup .tops{
  537 + width: 100%;
  538 +height: 145rpx;
  539 +border-bottom: 3rpx solid #eee;
  540 +
  541 +}
  542 +.top-content {
  543 + width: 82%;
  544 +padding-top: 33px;
  545 +height: 100%;
  546 +padding-left: 40rpx;
  547 +}
  548 +.close-frame{
  549 + margin-top: 30rpx;
  550 +
  551 +}
  552 +
  553 +.xc-hook {
  554 +width: 33rpx;
  555 +height: 33rpx;
  556 +transform: rotate(-135deg);
  557 +line-height: 35rpx;
  558 +text-align: center;
  559 +margin-right: 20rpx
  560 +
  561 +
  562 +}
  563 +.xc-hooks {
  564 +width: 30rpx;
  565 +height: 30rpx;
  566 +border: 1rpx solid #999;
  567 +margin-right: 20rpx;
  568 +}
  569 +.express_list_frame{
  570 + display: flex;
  571 +height: 80rpx;
  572 +align-items: center;
  573 +padding-left: 40rpx;
  574 +border-bottom: 1rpx solid #eee;
  575 +
  576 +}
  577 +.express_list{
  578 + width: 100%;
  579 + height: 65%;
  580 + overflow-y: auto;
  581 + margin-bottom: 40rpx;
  582 +
  583 +}
  584 +.xc-confirms {
  585 + box-sizing: border-box;
  586 + width: 40%;
  587 + border-radius: 50rpx;
  588 + height: 80rpx;
  589 + margin:0 auto;
  590 + font-size:28rpx;
  591 + background: #fff;
  592 + color: #333;
  593 + border: 2rpx solid #333;
  594 +}
  595 +
  596 +
  597 +/* 优惠券的改版样式 */
  598 +.xc-coupon-frame{
  599 + /* width: 710rpx; */
  600 + width: 100%;
  601 + height:auto;
  602 + margin: 0 auto;
  603 +
  604 +}
  605 +.xc-coupon-frame .coupon-frame{
  606 + width: 100%;
  607 + height: 200rpx;
  608 + margin-top:10rpx;
  609 + border-bottom: 1rpx solid #eee;
  610 +
  611 +}
  612 +.xc-coupon-frame .coupon-frame .coupon-left{
  613 + width: 215rpx;
  614 + height:100%;
  615 + overflow: hidden;
  616 +}
  617 +.xc-money-frames{
  618 + width:96%;
  619 + margin-top: -10px;
  620 +}
  621 +
  622 +.xc-rmb-symbol{
  623 + font-size:40rpx;
  624 +
  625 +}
  626 +
  627 +.xc-rmb-val{
  628 + font-size:60rpx;
  629 +
  630 +}
  631 +.coupon-explain{
  632 + font-size:25rpx;
  633 +width:100%;
  634 +
  635 +
  636 +}
  637 +.xc-valuer{
  638 + margin-top:39rpx;
  639 + margin-left:28rpx;
  640 + font-size:25rpx;
  641 +}
  642 +.coupon-frame .oval{
  643 + width:155rpx;
  644 + height:83rpx;
  645 + border-radius: 50%;
  646 + right:-78rpx;
  647 + top:-37rpx;
  648 +}
  649 +.coupon-right{
  650 + /* width:490rpx; */
  651 + height: 99%;
  652 + border-top: 1rpx solid #eaeaea;
  653 + /* //border-bottom: 1rpx solid #eaeaea; */
  654 + border-right: 1rpx solid #eaeaea;
  655 + flex-grow: 1;
  656 +}
  657 +.coupon-annotation{
  658 + width: 95%;
  659 + height: 100%;
  660 +
  661 +}
  662 +.xc-brand{
  663 + width:100rpx;
  664 + height:35rpx;
  665 + line-height: 35rpx;
  666 + font-size:21rpx;
  667 + border-radius:10rpx; position: relative; top:-1px;
  668 + margin-right: 8rpx
  669 +}
  670 +.top-frame{
  671 + width:82%;
  672 + height: 75rpx;
  673 + margin-top:10rpx;
  674 +}
  675 +.top-frame .coupon-wode{
  676 + font-size: 25rpx;
  677 + margin-left:10rpx;
  678 + width:340rpx;
  679 + height:88rpx;
  680 +}
  681 +.coupon-code{
  682 + width:60rpx;
  683 + height:60rpx;
  684 + margin-top:5rpx;
  685 +
  686 +}
  687 +.frame{
  688 + width: 100%
  689 +}
  690 +.coupon-time{
  691 + font-size: 23rpx;
  692 + line-height:33rpx;
  693 + color: #333;
  694 +}
  695 +
  696 +.clik-get{
  697 + width:125rpx;
  698 + height:45rpx;
  699 + border-radius: 25rpx;
  700 + line-height: 45rpx;
  701 + font-size:25rpx;
  702 + bottom:67rpx;
  703 + right:6px;
  704 +}
  705 +
  706 +.code-img{
  707 + margin-left:20rpx;
  708 +}
  709 +.bottmo-explain{
  710 +top:145rpx;
  711 +width:94%;
  712 +border-top:1rpx dashed #eee;
  713 +padding-top:8rpx;
  714 +height:38rpx;
  715 +line-height: 51rpx;
  716 +
  717 +}
  718 +.font-word{
  719 + font-size: 22rpx;
  720 +}
  721 +.circle-size{
  722 + background: #a0a0a0;
  723 + width: 27rpx;
  724 + height: 27rpx;
  725 + margin-top:13rpx;
  726 +margin-left:8rpx;
  727 +display: flex;
  728 +
  729 +align-items: center;
  730 +}
  731 +.xc-jiantou{
  732 + /* width: 9rpx;
  733 + height: 9rpx; */
  734 + /* border-top: 2rpx solid #fff;
  735 + border-right: 2rpx solid #fff; */
  736 + transform: rotate(-90deg);
  737 + color: #fff;
  738 + font-size: 15rpx;
  739 + /* display:inline-block;
  740 + margin-top: 6.5rpx; */
  741 + text-align: center;
  742 +width: 24rpx;
  743 +}
  744 +.xc-buttom{
  745 + box-sizing: border-box;
  746 + width:100%;
  747 + min-height:76rpx;
  748 + height:auto;
  749 + line-height:40rpx;
  750 + border-left:1rpx solid #eee;
  751 + border-right:1rpx solid #eee;
  752 + border-bottom:1rpx solid #eee;
  753 +/* margin-left: 6rpx; */
  754 +}
  755 +
  756 +.goods-num{
  757 + font-size: 28rpx;
  758 + color: #333;
  759 +}
  760 +
  761 +.explain-coupon{
  762 + font-size:25rpx;
  763 + padding: 10rpx 10rpx
  764 +}
  765 +.circle-frame{
  766 + width: 20rpx;
  767 + height: auto;
  768 + z-index:1;
  769 + left:210rpx;
  770 +
  771 +}
  772 +.circle-sawtooth{
  773 + width: 11rpx;
  774 + height: 11rpx;
  775 + background: #fff;
  776 +}
  777 +
  778 +.red{background-color: #fe7496;}
  779 +.green{ background-color: #22c7c1;}
  780 +.blue{background-color:#5e82e3;}
  781 +.g_gray{background-color: #aaaaaa}
  782 +
  783 +.f_text{text-align: center; height:96rpx; }
  784 +.xc-hook.sn {
  785 + margin-top:12%;
  786 +width:45rpx;
  787 +height:45rpx;
  788 +font-size:28rpx;
  789 +line-height:44rpx;
  790 +
  791 +
  792 +}
  793 +.xc-hooks.on{
  794 + margin-top:12%;
  795 +width:42rpx;
  796 +height:42rpx;
  797 +}
  798 +.may_use_coupon{
  799 + /* width: 95%; */
  800 + /* height: 68rpx; */
  801 + line-height:78rpx;
  802 + padding: 0 26rpx;
  803 + justify-content: space-between;
  804 + align-items: center;
  805 +}
  806 +.determine-frame{
  807 + width: 100%;
  808 + height: 130rpx;
  809 +
  810 +}
  811 +.xc-determine{
  812 + height: 80rpx;
  813 + width: 40%;
  814 + border-radius: 50rpx;
  815 +background: #d60021;
  816 +color: #fff;
  817 +font-size: 28rpx;
  818 +margin: 0 auto;
  819 +
  820 +}
  821 +.click-buttem{
  822 +width: 90%;
  823 +margin: auto;
  824 +}
  825 +.logistics-name{
  826 + margin-right:20rpx;
  827 +}
  828 +.xc-border{
  829 + border-top:8rpx solid #eee;
  830 +width: 100%
  831 +}
  832 +.main-top{
  833 +margin-top: 20rpx;
  834 +
  835 +}
  836 +.xc-hookts{
  837 +border: 1rpx solid #999;
  838 +
  839 +}
  840 +.xc-hookts.on{
  841 + width:30rpx;
  842 +height:30rpx;
  843 +
  844 +}
  845 +.xc-hookt.sn{
  846 + width: 32rpx;
  847 +height: 32rpx;
  848 +font-size: 28rpx;
  849 +line-height: 34rpx;
  850 +}
  851 +.xc-hookt{
  852 + transform: rotate(-135deg);
  853 +text-align: center;
  854 +
  855 +}
  856 +.main-bottom{
  857 + margin-bottom: 20rpx;
  858 +
  859 +}
  860 +.xc-hookst{
  861 + border: 1rpx solid #999;
  862 +
  863 +}
  864 +.xc-hookst.ons{
  865 + width: 42rpx;
  866 +height: 42rpx;
  867 +margin-left: 20rpx;
  868 +
  869 +}
  870 +.is_use_coupon{
  871 + width: 65%;
  872 +justify-content: flex-end;
  873 +padding-top: 10rpx;
  874 +
  875 +
  876 +}
  877 +.xc-hooka{
  878 + transform: rotate(-135deg);
  879 +text-align: center;
  880 +
  881 +}
  882 +.xc-hooka.sn{
  883 + width: 45rpx;
  884 +height: 45rpx;
  885 +font-size: 28rpx;
  886 +line-height: 44rpx;
  887 +margin-left: 20rpx;
  888 +
  889 +}
  890 +.color-gray{
  891 + color: #808080;
  892 +}
  893 +.n_guige{ display: inline-block; background:rgb(236, 236, 236); color: rgb(63,63,63); padding: 3rpx 10rpx; border-radius: 3rpx }
  894 +.gift_image{ width: 60rpx; height: 60rpx; position: absolute; top: 0; left: 0}
  895 +
  896 +.quan_num_show{ padding: 4rpx 6rpx; background-color:#ea5551; color:#fff; border-radius: 6rpx;margin-left:10rpx;font-size:24rpx;}
  897 +
  898 +.navigator-hover {
  899 + background: none;
  900 + opacity: 1;
  901 +}
  902 +
  903 +.plus_buy{
  904 + background-color: #fff;
  905 + margin:15rpx 0;
  906 + padding: 20rpx 10rpx;
  907 + position: relative;
  908 +}
  909 +
  910 +
  911 +.card_bg {
  912 + box-sizing: border-box;
  913 + padding: 2rpx 10rpx;
  914 + height: 28rpx;
  915 + border-radius: 26rpx;
  916 + font-size: 18rpx;
  917 + line-height: 28rpx;
  918 + max-width: 210rpx;
  919 + background: #333;
  920 + color: #fff;
  921 + margin-left: 8rpx;
  922 + position:relative;
  923 + top:7rpx;
  924 +}
  925 +
  926 +.card_bg image {
  927 + width: 19rpx;
  928 + height: 19rpx;
  929 + margin-right: 8rpx;
  930 +}
  931 +
  932 +/* .card_bg .card_name {
  933 + max-width: 76rpx;
  934 + width: auto;
  935 + overflow: hidden;
  936 + white-space: nowrap;
  937 +} */
  938 +
  939 +.card_name {
  940 + position: relative;
  941 + top: -4rpx;
  942 + margin-left: 6px;
  943 +}
  944 +
  945 +.car_tri_up {
  946 + width: 0;height: 0;
  947 + border-left: 20rpx solid transparent;
  948 + border-right: 20rpx solid transparent;
  949 + border-bottom: 20rpx solid #fff;
  950 + position: absolute;
  951 + right: 20rpx;
  952 + top:-10rpx
  953 +}
  954 +.card_op{
  955 + position: absolute;
  956 + right: 20rpx;
  957 + top:36rpx
  958 +}
  959 +
  960 +
  961 +.tab-container {
  962 + font-size: 28rpx;
  963 + margin-top: 20rpx;
  964 + display: flex;
  965 +}
  966 +
  967 +.tab-wrapper {
  968 + background-color: #ccc;
  969 + display: flex;
  970 + border-radius: 40rpx;
  971 + overflow: hidden;
  972 +}
  973 +
  974 +.tab {
  975 + padding: 20rpx 30rpx;
  976 +
  977 +}
  978 +
  979 +
  980 +.tab.active {
  981 + background-color: white;
  982 + border-radius: 40rpx;
  983 +}
packageC/pages/presell/goodsInfo/goodsInfo.js
1 -var t = require("../../../../utils/util.js"),  
2 - ut = t, 1 +var ut = require("../../../../utils/util.js"),
3 e = require("../../../../utils/common.js"), 2 e = require("../../../../utils/common.js"),
4 a = require("../../../../utils/wxParse/wxParse.js"), 3 a = require("../../../../utils/wxParse/wxParse.js"),
5 - s = getApp(), 4 + s = getApp(),app=s,
6 i = s.request, 5 i = s.request,
7 rq = i, 6 rq = i,
8 oo = s.globalData, 7 oo = s.globalData,
@@ -210,7 +209,6 @@ Page({ @@ -210,7 +209,6 @@ Page({
210 209
211 //是否点赞中 210 //是否点赞中
212 iszaning: 0, 211 iszaning: 0,
213 -  
214 select_store: 0, //选择更多 212 select_store: 0, //选择更多
215 index: 1, 213 index: 1,
216 more_store: 0, //选择门店 214 more_store: 0, //选择门店
@@ -249,15 +247,14 @@ Page({ @@ -249,15 +247,14 @@ Page({
249 fir_goods: null, 247 fir_goods: null,
250 248
251 share_hidden: false, 249 share_hidden: false,
  250 + pre_arr:null,
252 }, 251 },
253 252
254 //------初始化加载---------- 253 //------初始化加载----------
255 onLoad: function (t) { 254 onLoad: function (t) {
256 -  
257 - var ee = this,  
258 - that = ee,  
259 - th = ee,  
260 - gid =t.goods_id, 255 + var ee = this, that = ee, th = ee,
  256 + pre_id=t.pre_id,
  257 + gid=t.goods_id,
261 first_leader = t.first_leader, 258 first_leader = t.first_leader,
262 room_id = t.room_id, 259 room_id = t.room_id,
263 room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id 260 room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
@@ -296,18 +293,21 @@ Page({ @@ -296,18 +293,21 @@ Page({
296 if (gid == undefined || gid == null || gid == "") { 293 if (gid == undefined || gid == null || gid == "") {
297 var gid_str = decodeURIComponent(t.scene); 294 var gid_str = decodeURIComponent(t.scene);
298 gid_str = gid_str.split("_"); 295 gid_str = gid_str.split("_");
299 - gid = gid_str[0]; 296 + pre_id = gid_str[0];
300 if (gid_str.length > 1) { 297 if (gid_str.length > 1) {
301 - first_leader = gid_str[1]; 298 + pre_id = gid_str[1];
  299 + first_leader = gid_str[2];
302 } 300 }
303 //-- 如果有room_id的获取 -- 301 //-- 如果有room_id的获取 --
304 - if (gid_str.length > 2 && gid_str[2]) { 302 + if (gid_str.length > 2 && gid_str[3]) {
305 room_id = gid_str[2]; 303 room_id = gid_str[2];
306 room_user_share = 1; 304 room_user_share = 1;
307 } 305 }
308 -  
309 } 306 }
310 - ee.setData({ gid: gid }); 307 +
  308 + this.data.gid=gid;
  309 + this.data.pre_id=pre_id;
  310 +
311 if (first_leader) { 311 if (first_leader) {
312 console.log("log---".first_leader); 312 console.log("log---".first_leader);
313 getApp().globalData.first_leader = first_leader; 313 getApp().globalData.first_leader = first_leader;
@@ -418,68 +418,6 @@ Page({ @@ -418,68 +418,6 @@ Page({
418 }) 418 })
419 } 419 }
420 }); 420 });
421 -  
422 - //获取用户的默认门店  
423 - getApp().get_user_store(function (e) {  
424 - if (!e) {  
425 - th.data.fir_def_store = {}; //赋值空对象  
426 - return false;  
427 - }  
428 - var ee = JSON.parse(JSON.stringify(e));  
429 - //--定时器推迟一下--  
430 - setTimeout(function () {  
431 - if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;  
432 - //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--  
433 - if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {  
434 - //th.data.fir_def_store={}; //赋值空对象  
435 - //return false;  
436 - //th.data.fir_def_store.is_no_dis=1;  
437 - ee.is_no_dis = 1;  
438 - }  
439 -  
440 - var appd = getApp().globalData;  
441 - var w_time = setInterval(function () {  
442 - if (that.data.is_get_local_ok == 0) return false;  
443 - clearInterval(w_time);  
444 - var distance = null;  
445 - var e = JSON.parse(JSON.stringify(ee));  
446 -  
447 - //如果有开启近距离的话,同时距离优不一样了  
448 - if (that.data.lat != null) {  
449 - //如果经纬度有变化的话  
450 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {  
451 - that.set_def_storage(e);  
452 -  
453 - } else {  
454 - //要用接口是获取距离,js的计算不准  
455 - getApp().request.promiseGet("/api/weshop/pickup/list", {  
456 - data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon },  
457 - }).then(res => {  
458 - if (res.data.code == 0) {  
459 - e = res.data.data.pageData[0];  
460 - if (e) {  
461 - e.is_no_dis = ee.is_no_dis;  
462 - appd.pk_store = e;  
463 - that.set_def_storage(e);  
464 - }  
465 -  
466 - }  
467 - })  
468 - }  
469 - appd.lat = that.data.lat;  
470 - appd.lon = that.data.lon;  
471 -  
472 - } else {  
473 - if (e) {  
474 - e.distance = null;  
475 -  
476 - that.set_def_storage(e);  
477 - }  
478 - }  
479 - }, 500)  
480 - }, 700)  
481 - });  
482 -  
483 //更新点击量 421 //更新点击量
484 getApp().request.put("/api/weshop/goods/updateClick", { 422 getApp().request.put("/api/weshop/goods/updateClick", {
485 data: { store_id: os.stoid, goods_id: gid } 423 data: { store_id: os.stoid, goods_id: gid }
@@ -487,58 +425,17 @@ Page({ @@ -487,58 +425,17 @@ Page({
487 }, 425 },
488 426
489 427
490 - //--- 设置一下默认库存的数量 ----  
491 - set_def_storage(ee) {  
492 - var that = this, th = this;  
493 - getApp().getConfig2(function (e) {  
494 - var sales_rules = e.sales_rules;  
495 - if (sales_rules == 2) {  
496 - getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () {  
497 - var lock = 0, plist = null;  
498 - var gd = that.data.fir_goods;  
499 - //先读取门店的lock,采用链式写法,少用await  
500 - getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {  
501 - data: { store_id: os.stoid, wareId: that.data.fir_goods.goods_id, storageId: ee.pickup_id, pageSize: 1000 }  
502 - }).then(res => {  
503 - if (res.data.code == 0 && res.data.data.total > 0) {  
504 - for (var i in res.data.data.pageData)  
505 - lock += res.data.data.pageData[i].outQty  
506 - }  
507 - //---通过接口获取门店的线下库存信息--  
508 - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {  
509 - data: { storageNos: ee.pickup_no, wareIds: encodeURIComponent(th.data.data.erpwareid), storeId: os.stoid }  
510 - })  
511 - }).then(res => {  
512 - if (res.data.code == 0 && res.data.data.total > 0) {  
513 - plist = res.data.data.pageData[0];  
514 - }  
515 - if (plist && plist.CanOutQty - lock > 0) {  
516 - ee.CanOutQty = plist.CanOutQty - lock;  
517 - } else {  
518 - ee.CanOutQty = 0;  
519 - }  
520 - //--给门店赋值线下库存--  
521 - that.data.fir_def_store = ee;  
522 - that.setData({  
523 - def_pick_store: ee,  
524 - sto_sele_name: ee.pickup_name,  
525 - sto_sele_id: ee.pickup_id,  
526 - sto_sele_distr: ee.distr_type  
527 - })  
528 - })  
529 - })  
530 - } else { 428 + //--- 设置一下默认库存的数量 ----
  429 + set_def_storage(ee) {
  430 + var that = this, th = this;
531 that.data.fir_def_store = ee; 431 that.data.fir_def_store = ee;
532 that.setData({ 432 that.setData({
533 - def_pick_store: ee,  
534 - sto_sele_name: ee.pickup_name,  
535 - sto_sele_id: ee.pickup_id,  
536 - sto_sele_distr: ee.distr_type 433 + def_pick_store: ee,
  434 + sto_sele_name: ee.pickup_name,
  435 + sto_sele_id: ee.pickup_id,
  436 + sto_sele_distr: ee.distr_type
537 }) 437 })
538 - }  
539 - })  
540 -  
541 - }, 438 + },
542 439
543 440
544 //------------程序初始化入口------------- 441 //------------程序初始化入口-------------
@@ -553,36 +450,7 @@ Page({ @@ -553,36 +450,7 @@ Page({
553 fir_quan = null, 450 fir_quan = null,
554 mapurl = null, 451 mapurl = null,
555 mapurl_f_img = null; 452 mapurl_f_img = null;
556 - //------获取预售从表----------  
557 - await getApp().request.get("/api/weshop/marketing/marketingPresellList/page", {  
558 - data: {  
559 - is_end: 0,  
560 - store_id: os.stoid,  
561 - timetype: 1,  
562 - goods_id: gid  
563 - },  
564 - success: function (res) {  
565 - if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) {  
566 - var arr = res.data.data.pageData[0];  
567 - let presell_id=arr.presell_id;  
568 - th.setData({  
569 - presellList: arr,  
570 - })  
571 - //------获取预售主表----------  
572 - getApp().request.get(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {  
573 - success: function (res) {  
574 - console.log(res);  
575 - if (res.data.code == 0 && res.data.data) {  
576 - th.setData({  
577 - presellForm: res.data.data,  
578 - });  
579 - th.countDown(res.data.data.end_time)  
580 - }  
581 - }  
582 - })  
583 - }  
584 - }  
585 - }); 453 +
586 this.get_sto(); 454 this.get_sto();
587 //------图片滚动---------- 455 //------图片滚动----------
588 await getApp().request.promiseGet("/api/weshop/goodsimages/page", { 456 await getApp().request.promiseGet("/api/weshop/goodsimages/page", {
@@ -717,12 +585,12 @@ Page({ @@ -717,12 +585,12 @@ Page({
717 585
718 //---展示--- 586 //---展示---
719 onShow: function () { 587 onShow: function () {
720 - console.log('djfijsaoifjoisadjfoij');  
721 var goods_list = null, th = this, that = this; 588 var goods_list = null, th = this, that = this;
  589 +
  590 + //-- 如果是预览图片,页面不重新更新 --
722 var show_prew_img = this.data.show_prew_img 591 var show_prew_img = this.data.show_prew_img
723 if (show_prew_img) { 592 if (show_prew_img) {
724 - show_prew_img = 0;  
725 - return false; 593 + this.data.show_prew_img = 0; return false;
726 } 594 }
727 595
728 //优惠券要实时更新 596 //优惠券要实时更新
@@ -743,196 +611,205 @@ Page({ @@ -743,196 +611,205 @@ Page({
743 }, 300) 611 }, 300)
744 612
745 this.data.is_timer = 1; 613 this.data.is_timer = 1;
746 - var ee = this,  
747 - gid = this.data.gid,  
748 - i = getApp().request; 614 + var ee = this,gid = this.data.gid,i = getApp().request;
749 615
750 this.wait_for_store_config(); 616 this.wait_for_store_config();
751 - i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {  
752 - failRollback: !0,  
753 - success: function (t) {  
754 - console.log(t);  
755 - if (t.data.code == 0) {  
756 - if (t.data.data.is_on_sale != 1) {  
757 - wx.showModal({  
758 - title: '商品已经下架',  
759 - showCancel: !1,  
760 - complete: function () {  
761 - wx.navigateBack();  
762 - }  
763 - });  
764 - } 617 + this.get_pre_prom(function () {
  618 + i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {
  619 + failRollback: !0,
  620 + success: function (t) {
  621 + console.log(t);
  622 + if (t.data.code == 0) {
  623 + if (t.data.data.is_on_sale != 1) {
  624 + wx.showModal({
  625 + title: '商品已经下架',
  626 + showCancel: !1,
  627 + complete: function () {
  628 + wx.navigateBack();
  629 + }
  630 + });
  631 + }
  632 + var timestamp = Date.parse(new Date());
  633 + timestamp = timestamp / 1000;
  634 + if (t.data.data.on_time > timestamp) {
  635 + wx.showModal({
  636 + title: '商品还未上架',
  637 + showCancel: !1,
  638 + complete: function () {
  639 + wx.navigateBack();
  640 + }
  641 + });
  642 + }
765 643
766 - var timestamp = Date.parse(new Date());  
767 - timestamp = timestamp / 1000;  
768 - if (t.data.data.on_time > timestamp) {  
769 - wx.showModal({  
770 - title: '商品还未上架',  
771 - showCancel: !1,  
772 - complete: function () {  
773 - wx.navigateBack();  
774 - }  
775 - });  
776 - } 644 + if (t.data.data.down_time > 0) {
  645 + if (t.data.data.down_time < timestamp) {
  646 + wx.showModal({
  647 + title: '商品已经到期下架',
  648 + showCancel: !1,
  649 + complete: function () {
  650 + wx.navigateBack();
  651 + }
  652 + });
  653 + }
  654 + }
  655 + //动态获取商品名称
  656 + wx.setNavigationBarTitle({
  657 + title: t.data.data.goods_name,
  658 + });
777 659
778 - if (t.data.data.down_time > 0) {  
779 - if (t.data.data.down_time < timestamp) {  
780 - wx.showModal({  
781 - title: '商品已经到期下架',  
782 - showCancel: !1,  
783 - complete: function () {  
784 - wx.navigateBack();  
785 - }  
786 - });  
787 - }  
788 - }  
789 - //动态获取商品名称  
790 - wx.setNavigationBarTitle({  
791 - title: t.data.data.goods_name,  
792 - }); 660 + //-- 把商品的赋值 --
  661 + ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data));
793 662
794 - //-- 判断是不是组合购活动,必须要登录后才能判断 --  
795 - if (getApp().globalData.userInfo && t.data.data.prom_type == 7) {  
796 - //获取活动信息  
797 - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" +  
798 - t.data.data.prom_id + "/" + getApp().globalData.userInfo.user_id;  
799 - getApp().request.get(url, {  
800 - success: function (e) {  
801 - if (e.data.code == 0 && e.data.data) {  
802 - if (ut.gettimestamp() < e.data.data.start_time) {  
803 - return false;  
804 - }  
805 - if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) {  
806 - //-- 获取商品列表 --  
807 - th.setData({ zh_act: e.data.data });  
808 - } 663 + //获取用户的默认门店
  664 + getApp().get_user_store(function (e) {
  665 + if (!e) {
  666 + th.data.fir_def_store = {}; //赋值空对象
  667 + return false;
  668 + }
  669 + var ee = JSON.parse(JSON.stringify(e));
809 670
810 - }  
811 - }  
812 - });  
813 - } 671 + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
  672 + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
  673 + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
  674 + ee.is_no_dis = 1;
  675 + }
814 676
815 - //-- 把商品的赋值 --  
816 - ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data));  
817 - ee.check_is_youhui(ee.data.gid); 677 + var appd = getApp().globalData;
  678 + var w_time = setInterval(function () {
  679 + if (that.data.is_get_local_ok == 0) return false;
  680 + clearInterval(w_time);
  681 + var e = JSON.parse(JSON.stringify(ee));
  682 +
  683 + //如果有开启近距离的话,同时距离优不一样了
  684 + if (that.data.lat != null) {
  685 + //如果经纬度有变化的话
  686 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
  687 + that.set_def_storage(e);
  688 +
  689 + } else {
  690 + //要用接口是获取距离,js的计算不准
  691 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  692 + data: {
  693 + store_id: os.stoid,
  694 + pickup_id: e.pickup_id,
  695 + lat: th.data.lat,
  696 + lon: th.data.lon
  697 + },
  698 + }).then(res => {
  699 + if (res.data.code == 0) {
  700 + e = res.data.data.pageData[0];
  701 + if (e) {
  702 + e.is_no_dis = ee.is_no_dis;
  703 + appd.pk_store = e;
  704 + that.set_def_storage(e);
  705 + }
  706 +
  707 + }
  708 + })
  709 + }
  710 + appd.lat = that.data.lat;
  711 + appd.lon = that.data.lon;
  712 +
  713 + } else {
  714 + if (e) {
  715 + e.distance = null;
  716 +
  717 + that.set_def_storage(e);
  718 + }
  719 + }
  720 + }, 500)
  721 + });
818 722
819 - t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');  
820 723
821 - var cur_price = t.data.data.shop_price;  
822 - if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {  
823 - var cfile = getApp().globalData.userInfo.card_field;  
824 - if (t.data.data[cfile]) {  
825 - cur_price = t.data.data[cfile];  
826 - }  
827 - }  
828 - var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString();  
829 - txt = parseFloat(txt);  
830 724
831 - t.data.data['disc'] = txt; 725 + t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
832 726
833 - if (t.data.data.original_img.indexOf(o.imghost) == -1)  
834 - t.data.data.original_img = o.imghost + t.data.data.original_img; 727 + var cur_price = t.data.data.shop_price;
  728 + if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {
  729 + var cfile = getApp().globalData.userInfo.card_field;
  730 + if (t.data.data[cfile]) {
  731 + cur_price = t.data.data[cfile];
  732 + }
  733 + }
  734 + var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString();
  735 + txt = parseFloat(txt);
835 736
836 - if (t.data.data.goods_content == null) t.data.data.goods_content = ""; 737 + t.data.data['disc'] = txt;
  738 + if (t.data.data.original_img.indexOf(o.imghost) == -1)
  739 + t.data.data.original_img = o.imghost + t.data.data.original_img;
837 740
838 - //-----商品详情---  
839 - if (!t.data.data.goods_content) t.data.data.goods_content = " ";  
840 - a.wxParse("content", "html", t.data.data.goods_content, ee, 6);  
841 - e.wxParseAddFullImageUrl(ee, "content"); 741 + if (t.data.data.goods_content == null) t.data.data.goods_content = "";
842 742
843 - ee.setData({  
844 - data: t.data.data,  
845 - sele_g: t.data.data,  
846 - userInfo: getApp().globalData.userInfo  
847 - }); 743 + //-----商品详情---
  744 + if (!t.data.data.goods_content) t.data.data.goods_content = " ";
  745 + a.wxParse("content", "html", t.data.data.goods_content, ee, 6);
  746 + e.wxParseAddFullImageUrl(ee, "content");
848 747
  748 + ee.setData({
  749 + data: t.data.data,
  750 + sele_g: t.data.data,
  751 + userInfo: getApp().globalData.userInfo
  752 + });
849 753
850 - //获取统一条形码,普通商品和优惠促销的商品  
851 - 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) {  
852 - //默认门店要拿下门店库存  
853 - if (that.data.sales_rules == 2 && that.data.is_newsales_rules) {  
854 - //获取门店  
855 - ee.get_sto();  
856 - } else {  
857 - //获取门店  
858 - ee.get_sto();  
859 - } 754 + //获取门店
  755 + ee.get_sto();
  756 + ee.get_sku(o.stoid, t.data.data, gid);
860 757
861 - ee.get_sku(o.stoid, t.data.data, gid);  
862 - }  
863 - else {  
864 - var gg = "", item = t.data.data;  
865 758
866 - if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = "";  
867 - if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; 759 + ee.data.g_buy_num = new Map();
868 760
869 - if (item.goods_spec != "" && item.goods_color != "") {  
870 - gg = item.goods_spec + "/" + item.goods_color;  
871 - } else if (item.goods_spec != "" || item.goods_color != "") {  
872 - gg = item.goods_spec + item.goods_color;  
873 - } else {  
874 - gg = "规格1";  
875 - }  
876 - t.data.data.gg = gg;  
877 - var uu = [];  
878 - uu.push(t.data.data);  
879 - ee.setData({  
880 - sku_g: uu,  
881 - });  
882 - }  
883 - ee.data.g_buy_num = new Map();  
884 - ee.check_prom(gid, ee.data.data.prom_type, ee.data.data.prom_id); 761 + if (ee.data.cat_name == '') {
  762 + //过去国别,分类,品牌的名称
  763 + i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, {
  764 + success: function (t) {
  765 + var dd = t.data.data;
  766 + if (t.data.code == 0) {
  767 + th.setData({
  768 + cat_name: dd.name
  769 + });
  770 + }
  771 + }
  772 + });
  773 + //过去国别,分类,品牌的名称
  774 + i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, {
  775 + success: function (t) {
  776 + var dd = t.data.data;
  777 + if (t.data.code == 0) {
  778 + th.setData({
  779 + brand_name: dd.name
  780 + });
  781 + }
  782 + }
  783 + });
  784 + //过去国别,分类,品牌的名称
  785 + i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, {
  786 + success: function (t) {
  787 + var dd = t.data.data;
  788 + if (t.data.code == 0) {
  789 + th.setData({
  790 + nation_name: dd.name
  791 + });
  792 + }
  793 + }
  794 + });
  795 + }
885 796
886 - var th = ee;  
887 - if (ee.data.cat_name == '') {  
888 - //过去国别,分类,品牌的名称  
889 - i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, {  
890 - success: function (t) {  
891 - var dd = t.data.data;  
892 - if (t.data.code == 0) {  
893 - th.setData({  
894 - cat_name: dd.name  
895 - });  
896 } 797 }
897 - }  
898 - });  
899 - //过去国别,分类,品牌的名称  
900 - i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, {  
901 - success: function (t) {  
902 - var dd = t.data.data;  
903 - if (t.data.code == 0) {  
904 - th.setData({  
905 - brand_name: dd.name  
906 - });  
907 - }  
908 - }  
909 - });  
910 - //过去国别,分类,品牌的名称  
911 - i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, {  
912 - success: function (t) {  
913 - var dd = t.data.data;  
914 - if (t.data.code == 0) {  
915 - th.setData({  
916 - nation_name: dd.name  
917 - }); 798 + else {
  799 + wx.showModal({
  800 + title: t.data.msg,
  801 + showCancel: !1,
  802 + complete: function () {
  803 + wx.navigateBack();
  804 + }
  805 + });
918 } 806 }
919 - }  
920 - });  
921 - }  
922 -  
923 - }  
924 - else {  
925 - wx.showModal({  
926 - title: t.data.msg,  
927 - showCancel: !1,  
928 - complete: function () {  
929 - wx.navigateBack();  
930 } 807 }
931 - });  
932 - }  
933 - }  
934 - });  
935 - this.data.enterAddressPage && (this.data.enterAddressPage = !1); 808 + });
  809 + ee.data.enterAddressPage && (this.data.enterAddressPage = !1);
  810 + })
  811 +
  812 +
936 813
937 }, 814 },
938 enterAddress: function () { 815 enterAddress: function () {
@@ -1054,127 +931,15 @@ Page({ @@ -1054,127 +931,15 @@ Page({
1054 var th = this; 931 var th = this;
1055 var ind = t.currentTarget.dataset.openSpecModal_ind; 932 var ind = t.currentTarget.dataset.openSpecModal_ind;
1056 if (!ind) ind = t.currentTarget.dataset.openspecmodal_ind; 933 if (!ind) ind = t.currentTarget.dataset.openspecmodal_ind;
1057 - th.setData({  
1058 - open_ind_store: ind 934 + th.setData({
  935 + open_ind_store: ind
1059 }); 936 });
1060 - //如果是秒杀的话,要看redis够不够  
1061 - if (this.data.prom_type == 1) {  
1062 - this.getactLen(function (num) {  
1063 - if (num < th.data.goodsInputNum) {  
1064 - getApp().my_warnning("秒杀库存不足!", 0, th);  
1065 - return false;  
1066 - } else {  
1067 - th.add_cart_func(t);  
1068 - }  
1069 - });  
1070 - } else {  
1071 - th.add_cart_func(t);  
1072 - } 937 +
  938 + th.add_cart_func(t);
  939 +
1073 }, 940 },
1074 941
1075 942
1076 -  
1077 - //-- 加入购物的函数 --  
1078 - add_cart_func_inte: function (t) {  
1079 - var i = getApp().request;  
1080 - if (oo.user_id == null) {  
1081 - return s.my_warnning("还未登录!", 0, this);  
1082 - }  
1083 - if (!getApp().globalData.userInfo) {  
1084 - return s.my_warnning("还未登录!", 0, this);  
1085 - }  
1086 -  
1087 - var e = this,  
1088 - th = e,  
1089 - a = 0,  
1090 - o = this.data.data;  
1091 - a = o.goods_id;  
1092 -  
1093 - //----------添加到购物车时,要判断限购数量,--------  
1094 - e.get_buy_num(o, function (ee) {  
1095 - //---判断商品是否超出限购---  
1096 - if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {  
1097 - if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {  
1098 - wx.showModal({  
1099 - title: '提示',  
1100 - content: '超出商品限购'  
1101 - });  
1102 - return false;  
1103 - }  
1104 - }  
1105 - //---判断商品是否超出活动限购---  
1106 - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) {  
1107 - if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {  
1108 - wx.showModal({  
1109 - title: '提示',  
1110 - content: '超出商品活动限购'  
1111 - });  
1112 - return false;  
1113 - }  
1114 - }  
1115 -  
1116 - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);  
1117 - if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)  
1118 - this.setData({  
1119 - sto_sele_name: ""  
1120 - });  
1121 - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);  
1122 -  
1123 - //--------------此时操作的数据------------  
1124 - var newd = {  
1125 - goods_id: o.goods_id,  
1126 - goods_num: th.data.goodsInputNum,  
1127 - pick_id: th.data.sto_sele_id,  
1128 - user_id: oo.user_id,  
1129 - store_id: th.data.stoid,  
1130 - goods_price: th.data.prom_price,  
1131 - integral: th.data.prom_integral,  
1132 - member_goods_price: o.shop_price,  
1133 - goods_name: o.goods_name,  
1134 - goods_sn: o.goods_sn,  
1135 - sku: o.sku,  
1136 - };  
1137 -  
1138 - //---是不是从收藏夹出来的---  
1139 - if (th.data.c_guide_id) {  
1140 - newd['guide_id'] = th.data.c_guide_id;  
1141 - newd['guide_type'] = 2;  
1142 - if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3;  
1143 - } else {  
1144 - if (getApp().globalData.guide_id) {  
1145 - newd['guide_id'] = getApp().globalData.guide_id;  
1146 - newd['guide_type'] = 0;  
1147 - if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1;  
1148 - }  
1149 - }  
1150 -  
1151 - //让商品带上房间号  
1152 - //让商品带上房间号  
1153 - if (th.data.sys_switch.is_skuroom_id == 1) {  
1154 - if (th.data.data.goods_id == getApp().globalData.room_goods_id) {  
1155 - newd.room_id = getApp().globalData.room_id;  
1156 - }  
1157 - } else {  
1158 - if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id;  
1159 - }  
1160 -  
1161 - //如果是积分够,is_integral_normal就要有积分购普通购买字段  
1162 - //if(o.prom_type==4){  
1163 - //newd.is_integral_normal=1;  
1164 - //}  
1165 -  
1166 - //-----如果是秒杀,团购,积分购,拼团-----  
1167 - newd.prom_type = th.data.prom_type;  
1168 - newd.prom_id = th.data.prom_id;  
1169 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
1170 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
1171 -  
1172 -  
1173 - th.add_cart_next(e, t, a, o, newd); //立即购买下一步  
1174 -  
1175 - })  
1176 - },  
1177 -  
1178 //-- 加入购物的函数 -- 943 //-- 加入购物的函数 --
1179 add_cart_func: function (t) { 944 add_cart_func: function (t) {
1180 var i = getApp().request; 945 var i = getApp().request;
@@ -1186,12 +951,7 @@ Page({ @@ -1186,12 +951,7 @@ Page({
1186 return s.my_warnning("还未登录!", 0, this); 951 return s.my_warnning("还未登录!", 0, this);
1187 } 952 }
1188 953
1189 - var e = this,  
1190 - th = e,  
1191 - a = 0,  
1192 - o = this.data.sele_g;  
1193 - a = o.goods_id;  
1194 - 954 + var e = this,th = e, o = this.data.sele_g,a = o.goods_id;
1195 //----------添加到购物车时,要判断限购数量,-------- 955 //----------添加到购物车时,要判断限购数量,--------
1196 e.get_buy_num(o, function (ee) { 956 e.get_buy_num(o, function (ee) {
1197 //---判断商品是否超出限购--- 957 //---判断商品是否超出限购---
@@ -1234,6 +994,7 @@ Page({ @@ -1234,6 +994,7 @@ Page({
1234 goods_name: o.goods_name, 994 goods_name: o.goods_name,
1235 goods_sn: o.goods_sn, 995 goods_sn: o.goods_sn,
1236 sku: o.sku, 996 sku: o.sku,
  997 + presell_list_id:th.data.presellList.id,
1237 }; 998 };
1238 999
1239 //---是不是从收藏夹出来的--- 1000 //---是不是从收藏夹出来的---
@@ -1270,163 +1031,22 @@ Page({ @@ -1270,163 +1031,22 @@ Page({
1270 newd.pricing_type = o.pricing_type; 1031 newd.pricing_type = o.pricing_type;
1271 } 1032 }
1272 1033
1273 - //-----如果是秒杀,团购,积分购,拼团-----  
1274 - if (th.data.prom_type == 1) {  
1275 newd.goods_price = th.data.prom_price; 1034 newd.goods_price = th.data.prom_price;
1276 newd.member_goods_price = th.data.prom_price, 1035 newd.member_goods_price = th.data.prom_price,
1277 - newd.prom_type = th.data.prom_type;  
1278 - newd.prom_id = th.data.prom_id; 1036 + newd.prom_type = 8;
  1037 + newd.prom_id = o.prom_id;
1279 1038
1280 if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); 1039 if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
1281 if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); 1040 if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
1282 -  
1283 th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 1041 th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
1284 1042
1285 - } else if (o.prom_type == 7) {  
1286 -  
1287 - //判断进行中的活动,是不是要判断线下库存  
1288 - th.check_zh_acting(function (ee) {  
1289 - newd.prom_id = 0;  
1290 - newd.prom_type = 0;  
1291 - if (ee && th.data.sele_g.act) {  
1292 - newd.prom_id = th.data.sele_g.act.id;  
1293 - newd.prom_type = 7;  
1294 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
1295 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
1296 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
1297 - return false;  
1298 - } else {  
1299 - //---如果是线下门店销售的时候---  
1300 - if (th.data.sales_rules == 2) {  
1301 - var pick = th.get_pick_from_list(th.data.sto_sele_id)  
1302 - //---通过接口获取门店的线下库存信息--  
1303 - getApp().request.get("/api/weshop/goods/getWareStorages", {  
1304 - data: { storageNos: pick.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid },  
1305 - success: function (res) {  
1306 - if (res.data.code == 0) {  
1307 - if (res.data.data.pageData.length > 0) {  
1308 - var CanOutQty = res.data.data.pageData[0].CanOutQty;  
1309 - if (CanOutQty < e.data.goodsInputNum) {  
1310 - return s.my_warnning("库存不足!", 0, th);  
1311 - }  
1312 - //在调一次接口,读取商品的预出库的数量,lock  
1313 - getApp().request.get("/api/weshop/order/ware/lock/page", {  
1314 - data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, storageId: pick.pickup_id, pageSize: 1000 },  
1315 - success: function (res_data) {  
1316 - if (res_data.data.code == 0 && res_data.data.data.total > 0) {  
1317 -  
1318 - var lock = 0;  
1319 - for (var i in res_data.data.data.pageData) {  
1320 - lock += res_data.data.data.pageData[i].outQty;  
1321 - }  
1322 -  
1323 - if (CanOutQty <= lock) {  
1324 - return s.my_warnning("库存不足!", 0, th);  
1325 - }  
1326 - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);  
1327 - } else {  
1328 - th.add_cart_next(e, t, a, o, newd, CanOutQty);  
1329 - }  
1330 - }  
1331 - })  
1332 - } else {  
1333 - return s.my_warnning("库存不足!", 0, th);  
1334 - }  
1335 -  
1336 - }  
1337 - }  
1338 - })  
1339 - } else {  
1340 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
1341 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
1342 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
1343 - }  
1344 - }  
1345 - })  
1346 -  
1347 - }  
1348 - 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) {  
1349 - newd.prom_type = 0;  
1350 - newd.prom_id = 0;  
1351 -  
1352 - //---如果是线下门店销售的时候---  
1353 - if (th.data.sales_rules == 2) {  
1354 - var pick = th.get_pick_from_list(th.data.sto_sele_id)  
1355 - //---通过接口获取门店的线下库存信息--  
1356 - getApp().request.get("/api/weshop/goods/getWareStorages", {  
1357 - data: { storageNos: pick.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid },  
1358 - success: function (res) {  
1359 - if (res.data.code == 0) {  
1360 - if (res.data.data.pageData.length > 0) {  
1361 - var CanOutQty = res.data.data.pageData[0].CanOutQty;  
1362 - if (CanOutQty < e.data.goodsInputNum) {  
1363 - return s.my_warnning("库存不足!", 0, th);  
1364 - }  
1365 - //在调一次接口,读取商品的预出库的数量,lock  
1366 - getApp().request.get("/api/weshop/order/ware/lock/page", {  
1367 - data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, storageId: pick.pickup_id, pageSize: 1000 },  
1368 - success: function (res_data) {  
1369 - if (res_data.data.code == 0 && res_data.data.data.total > 0) {  
1370 -  
1371 - var lock = 0;  
1372 - for (var i in res_data.data.data.pageData) {  
1373 - lock += res_data.data.data.pageData[i].outQty;  
1374 - }  
1375 -  
1376 - if (CanOutQty <= lock) {  
1377 - return s.my_warnning("库存不足!", 0, th);  
1378 - }  
1379 - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);  
1380 - } else {  
1381 - th.add_cart_next(e, t, a, o, newd, CanOutQty);  
1382 - }  
1383 - }  
1384 - })  
1385 - } else {  
1386 - return s.my_warnning("库存不足!", 0, th);  
1387 - }  
1388 -  
1389 - }  
1390 - }  
1391 - })  
1392 - } else {  
1393 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
1394 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
1395 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
1396 - }  
1397 - } 1043 +
1398 }) 1044 })
1399 }, 1045 },
1400 1046
1401 //---加入购物车的最后一步--- 1047 //---加入购物车的最后一步---
1402 add_cart_next(e, t, a, o, newd, CanOutQty) { 1048 add_cart_next(e, t, a, o, newd, CanOutQty) {
1403 var th = this, i = getApp().request; 1049 var th = this, i = getApp().request;
1404 - //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------  
1405 - if (o.prom_type != 1 && ((o.prom_type != 6 && o.prom_type != 4) || th.data.is_normal)) {  
1406 - var conf = th.data.bconfig;  
1407 - if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) {  
1408 - var s_list = JSON.parse(conf.switch_list);  
1409 - var now = ut.gettimestamp();  
1410 -  
1411 -  
1412 - var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/');  
1413 - var end = new Date(str);  
1414 - end = Date.parse(end) / 1000;  
1415 -  
1416 - //--如果后台有开启等级价的功能,而且会员的等级没有过期的情况下--  
1417 - if (parseInt(s_list.rank_switch) == 2 && end > now) {  
1418 - var card_price = o[getApp().globalData.userInfo['card_field']];  
1419 - //如果会员有等级价  
1420 - if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null  
1421 - && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) {  
1422 - newd.goods_price = card_price;  
1423 - newd.member_goods_price = card_price;  
1424 - }  
1425 - }  
1426 - }  
1427 - }  
1428 -  
1429 - //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d);  
1430 if ("add" == t.currentTarget.dataset.action) { 1050 if ("add" == t.currentTarget.dataset.action) {
1431 1051
1432 if (th.data.prom_goods) { 1052 if (th.data.prom_goods) {
@@ -1506,102 +1126,29 @@ Page({ @@ -1506,102 +1126,29 @@ Page({
1506 }); 1126 });
1507 } 1127 }
1508 } 1128 }
1509 - });  
1510 -  
1511 - }  
1512 - //else "exchange" == t.currentTarget.dataset.action ? this.exchange(d) : this.buyNow(d);  
1513 - else {  
1514 -  
1515 - if (th.data.prom_goods) {  
1516 - var prom_d = th.data.prom_goods;  
1517 - for (var i in prom_d) {  
1518 - //判断活动有俩种条件,0元 1件  
1519 - var condition_t = prom_d[i].prom_type;  
1520 - switch (condition_t) {  
1521 - case 0: //按钱  
1522 - if (newd.goods_price >= condition_t) {  
1523 - newd.prom_type = 3;  
1524 - newd.prom_id = prom_d[i].prom_id;  
1525 - }  
1526 - break  
1527 - case 1://按购买数量  
1528 - if (newd.goods_num >= condition_t) {  
1529 - newd.prom_type = 3;  
1530 - newd.prom_id = prom_d[i].prom_id;  
1531 - }  
1532 - break;  
1533 - }  
1534 - }  
1535 -  
1536 - } 1129 + })
1537 1130
  1131 + }else {
1538 newd['pick_name'] = th.data.sto_sele_name; 1132 newd['pick_name'] = th.data.sto_sele_name;
1539 newd['pick_dis'] = th.data.sto_sele_distr; 1133 newd['pick_dis'] = th.data.sto_sele_distr;
1540 th.buyNow(newd); 1134 th.buyNow(newd);
1541 } 1135 }
1542 }, 1136 },
1543 1137
1544 -  
1545 - //----------购买虚拟商品------  
1546 - buyVirtualGoods: function (e) {  
1547 - Object.assign(e, {  
1548 - goods_name: this.data.data.goods.goods_name,  
1549 - spec_name: this.data.select.specName,  
1550 - price: this.data.select.price  
1551 - }), wx.navigateTo({  
1552 - url: "/pages/virtual/buy_step/buy_step?" + t.Obj2Str(e)  
1553 - });  
1554 - },  
1555 - //----------积分兑换---------  
1556 - exchange: function (e) {  
1557 - this.data.shippingCost < 0 || this.data.select.stock <= 0 || wx.navigateTo({  
1558 - url: "/pages/cart/integral/integral?" + t.Obj2Str(e)  
1559 - });  
1560 - },  
1561 -  
1562 -  
1563 //----------立即购买----------- 1138 //----------立即购买-----------
1564 buyNow: function (e) { 1139 buyNow: function (e) {
1565 - // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, {  
1566 - // action: "buy_now"  
1567 - // }), 1140 +
1568 this.setData({ 1141 this.setData({
1569 openSpecModal: 0, 1142 openSpecModal: 0,
1570 openSpecModal_inte: 0, 1143 openSpecModal_inte: 0,
1571 openSpecModal_inte_normal: 0, 1144 openSpecModal_inte_normal: 0,
1572 openSpecModal_pt: 0, 1145 openSpecModal_pt: 0,
1573 }) 1146 })
1574 -  
1575 - if (e.prom_type == 4) {  
1576 - s.set_b_now(e);  
1577 - var url = "/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id;  
1578 - getApp().goto(url);  
1579 - } else {  
1580 - //要判断积分购的普通购买有没有参加优惠活动  
1581 - if (e.is_integral_normal == 1) {  
1582 - this.check_nor_promgood(e.goods_id, function (res) {  
1583 - if (res && res.cat_id) {  
1584 - e.prom_type = 3;  
1585 - e.prom_id = res.cat_id  
1586 - }  
1587 - s.set_b_now(e);  
1588 - /*--  
1589 - wx.redirectTo({  
1590 - url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,  
1591 - });--*/  
1592 - getApp().goto("/packageC/pages/presell/cart/cart?is_bnow=1&goods_id=" + e.goods_id)  
1593 -  
1594 - })  
1595 - } else {  
1596 - s.set_b_now(e);  
1597 - /*--  
1598 - wx.redirectTo({  
1599 - url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,  
1600 - });--*/  
1601 - getApp().goto("/packageC/pages/presell/cart/cart?is_bnow=1&goods_id=" + e.goods_id)  
1602 - }  
1603 -  
1604 - } 1147 +
  1148 + app.set_b_now(e);
  1149 + getApp().goto("/packageC/pages/presell/cart/cart2_pre");
  1150 +
  1151 +
1605 }, 1152 },
1606 1153
1607 //----------增加购买数量----------- 1154 //----------增加购买数量-----------
@@ -1654,7 +1201,7 @@ Page({ @@ -1654,7 +1201,7 @@ Page({
1654 } 1201 }
1655 1202
1656 //--判断商品是否超出活动限购-- 1203 //--判断商品是否超出活动限购--
1657 - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) { 1204 + if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) {
1658 if (t + th.data.prom_buy_num > th.data.prom_buy_limit) { 1205 if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
1659 wx.showModal({ 1206 wx.showModal({
1660 title: '超出商品活动限购', 1207 title: '超出商品活动限购',
@@ -1667,24 +1214,8 @@ Page({ @@ -1667,24 +1214,8 @@ Page({
1667 } 1214 }
1668 } 1215 }
1669 1216
1670 - if (th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) {  
1671 - var redis_num = 0;  
1672 - //------判断活动是否抢光-----  
1673 - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +  
1674 - os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, {  
1675 - 1: 1  
1676 - }).then(res => {  
1677 - redis_num = res.data.data;  
1678 - });  
1679 1217
1680 - if (t > redis_num) {  
1681 - wx.showModal({  
1682 - title: '超出商品活动库存',  
1683 - });  
1684 - th.setData({ goodsInputNum: redis_num })  
1685 - return false;  
1686 - }  
1687 - } 1218 +
1688 var e = th.data.sele_g.store_count; 1219 var e = th.data.sele_g.store_count;
1689 var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 1220 var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4
1690 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)) { 1221 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({ @@ -1795,7 +1326,6 @@ Page({
1795 sele_g: this.data.data, 1326 sele_g: this.data.data,
1796 gid: this.data.data.goods_id 1327 gid: this.data.data.goods_id
1797 }) 1328 })
1798 -  
1799 this.sele_spec_chech_activity(); 1329 this.sele_spec_chech_activity();
1800 1330
1801 } 1331 }
@@ -2173,14 +1703,13 @@ Page({ @@ -2173,14 +1703,13 @@ Page({
2173 1703
2174 //-----图片失败,默认图片----- 1704 //-----图片失败,默认图片-----
2175 bind_bnerr2: function (e) { 1705 bind_bnerr2: function (e) {
2176 -  
2177 var _errImg = e.target.dataset.errorimg; 1706 var _errImg = e.target.dataset.errorimg;
2178 var _errObj = {}; 1707 var _errObj = {};
2179 _errObj[_errImg] = this.data.iurl + "/miniapp/images/hui_hear_pic.png" 1708 _errObj[_errImg] = this.data.iurl + "/miniapp/images/hui_hear_pic.png"
2180 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; 1709 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
2181 }, 1710 },
2182 1711
2183 - //----------装载同一条形码的商品---------- 1712 + //----------装载同一活动中的商品----------
2184 async get_sku(stoid, gd, g_id, is_normal, func) { 1713 async get_sku(stoid, gd, g_id, is_normal, func) {
2185 var tt = this, arrdata = null; 1714 var tt = this, arrdata = null;
2186 var now = ut.gettimestamp(); 1715 var now = ut.gettimestamp();
@@ -2192,7 +1721,9 @@ Page({ @@ -2192,7 +1721,9 @@ Page({
2192 isonsale: 1, 1721 isonsale: 1,
2193 is_on_sale: 1, 1722 is_on_sale: 1,
2194 pageSize: 500, 1723 pageSize: 500,
2195 - orderField: 'sort' 1724 + orderField: 'sort',
  1725 + prom_id:tt.data.presellForm.id,
  1726 + prom_type:8,
2196 } 1727 }
2197 }).then(res => { 1728 }).then(res => {
2198 var e = res; 1729 var e = res;
@@ -2234,7 +1765,6 @@ Page({ @@ -2234,7 +1765,6 @@ Page({
2234 if (res.data.code == 0) prom = res.data.data; 1765 if (res.data.code == 0) prom = res.data.data;
2235 }) 1766 })
2236 break 1767 break
2237 -  
2238 } 1768 }
2239 1769
2240 1770
@@ -2314,43 +1844,8 @@ Page({ @@ -2314,43 +1844,8 @@ Page({
2314 gid: gid 1844 gid: gid
2315 }); 1845 });
2316 1846
2317 -  
2318 -  
2319 - that.check_is_youhui(gid, that.data.is_normal);  
2320 -  
2321 - var ty = 0;  
2322 - this.get_sto(that.data.is_normal);  
2323 -  
2324 -  
2325 - //默认门店要拿下门店库存  
2326 - if (that.data.sales_rules == 2 && that.data.def_pick_store) {  
2327 - var lock = 0, plist = null;  
2328 - //先读取门店的lock,采用链式写法,少用await  
2329 - getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {  
2330 - data: { store_id: os.stoid, wareId: ee.data.sele_g.goods_id, storageId: that.data.def_pick_store.pickup_id, pageSize: 1000 }  
2331 - }).then(res => {  
2332 - if (res.data.code == 0 && res.data.data.total > 0) {  
2333 - for (var i in res.data.data.pageData)  
2334 - lock += res.data.data.pageData[i].outQty  
2335 - }  
2336 - //---通过接口获取门店的线下库存信息--  
2337 - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {  
2338 - data: { storageNos: that.data.def_pick_store.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid }  
2339 - })  
2340 - }).then(res => {  
2341 - if (res.data.code == 0 && res.data.data.total > 0) {  
2342 - plist = res.data.data.pageData[0];  
2343 - }  
2344 - if (plist && plist.CanOutQty - lock > 0) {  
2345 - that.data.def_pick_store.CanOutQty = plist.CanOutQty - lock;  
2346 - } else {  
2347 - that.data.def_pick_store.CanOutQty = 0;  
2348 - }  
2349 - //--给门店赋值线下库存--  
2350 - th.setData({ def_pick_store: that.data.def_pick_store });  
2351 - })  
2352 - }  
2353 - 1847 + //that.check_is_youhui(gid, that.data.is_normal);
  1848 + this.get_sto();
2354 1849
2355 this.sele_spec_chech_activity(); 1850 this.sele_spec_chech_activity();
2356 }, 1851 },
@@ -2415,8 +1910,7 @@ Page({ @@ -2415,8 +1910,7 @@ Page({
2415 1910
2416 //---------拿出门店分类和门店------------ 1911 //---------拿出门店分类和门店------------
2417 get_sto(e) { 1912 get_sto(e) {
2418 - var th = this, that = this;  
2419 - var is_normal = e; 1913 + var th = this,is_normal = e;
2420 1914
2421 if (e == 1) { 1915 if (e == 1) {
2422 th.setData({ is_normal: 1 }) 1916 th.setData({ is_normal: 1 })
@@ -2891,24 +2385,11 @@ Page({ @@ -2891,24 +2385,11 @@ Page({
2891 //加载更多是靠这个函数 2385 //加载更多是靠这个函数
2892 onReachBottom: function () { 2386 onReachBottom: function () {
2893 if (this.data.activeCategoryId == 2) { 2387 if (this.data.activeCategoryId == 2) {
2894 - if (!this.data.comments_no_more) this.requestComments_new();  
2895 - }  
2896 -  
2897 - var goods_list = this.selectComponent("#goods_list"); //组件的id  
2898 - if (goods_list) goods_list.get_list();  
2899 - },  
2900 -  
2901 - //--------检查是否活动,活动是否开始,或者是否结束-------  
2902 - async check_prom(gid, prom_type, prom_id) {  
2903 - var ee = this,  
2904 - th = ee;  
2905 - if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7) {  
2906 - this.setData({  
2907 - prom_type: 0,  
2908 - isshow: 1,  
2909 - });  
2910 - return false;  
2911 - } 2388 + if (!this.data.comments_no_more) this.requestComments_new();
  2389 + }
  2390 +
  2391 + var goods_list = this.selectComponent("#goods_list"); //组件的id
  2392 + if (goods_list) goods_list.get_list();
2912 }, 2393 },
2913 2394
2914 //--获取有多少人在开团-- 2395 //--获取有多少人在开团--
@@ -3107,213 +2588,6 @@ Page({ @@ -3107,213 +2588,6 @@ Page({
3107 }); 2588 });
3108 }, 2589 },
3109 2590
3110 - //--------拼团玩法显示详情--------  
3111 - show_pt_xx: function (e) {  
3112 - this.setData({  
3113 - pd_xx: 1,  
3114 - })  
3115 - },  
3116 - close_pt_xx: function () {  
3117 - this.setData({  
3118 - pd_xx: 0,  
3119 - })  
3120 - },  
3121 -  
3122 -  
3123 - //-----------------拼单生成方法---------------------  
3124 - addCart_pt: function () {  
3125 - var th = this;  
3126 - if (this.data.is_normal == 0) {  
3127 - //看一下有没有起购数,如果有起购数,要计算起购数  
3128 - var qnum = parseFloat(th.data.prom_act.minbuynum);  
3129 - if (qnum > 0 && th.data.goodsInputNum < qnum) {  
3130 - getApp().confirmBox("拼团商品至少要买" + qnum + "件!");  
3131 - return false;  
3132 - }  
3133 -  
3134 - th.addcart_pt_func();  
3135 - } else {  
3136 - th.addcart_pt_func();  
3137 - }  
3138 - },  
3139 -  
3140 - addcart_pt_func: function () {  
3141 - if (oo.user_id == null) {  
3142 - s.my_warnning("还未登录!", 0, this);  
3143 - return;  
3144 - }  
3145 - var e = this,  
3146 - th = e,  
3147 - o = this.data.sele_g;  
3148 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
3149 -  
3150 - //----------添加到购物车时,要判断限购数量,--------  
3151 - e.get_buy_num(o, async function (ee) {  
3152 -  
3153 - //---判断商品是否超出限购---  
3154 - if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {  
3155 - if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {  
3156 - wx.showModal({  
3157 - title: '提示',  
3158 - content: '超出商品限购'  
3159 - });  
3160 -  
3161 - var num = th.data.prom_buy_limit - th.data.prom_buy_num;  
3162 - if (num < 0) num = 0;  
3163 - th.setData({ goodsInputNum: num })  
3164 - return false;  
3165 - }  
3166 - }  
3167 - //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购---  
3168 - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) {  
3169 - if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {  
3170 - wx.showModal({  
3171 - title: '提示',  
3172 - content: '超出商品活动限购'  
3173 - });  
3174 -  
3175 - var num = th.data.prom_buy_limit - th.data.prom_buy_num;  
3176 - if (num < 0) num = 0;  
3177 - th.setData({ goodsInputNum: num })  
3178 - return false;  
3179 - }  
3180 - }  
3181 -  
3182 - var redis_num = 0  
3183 - //不是普通购买的时候  
3184 - if (th.data.is_normal != 1) {  
3185 - //-------判断活动是否抢光---------  
3186 - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, {  
3187 - 1: 1  
3188 - }).then(res => {  
3189 - redis_num = res.data.data;  
3190 - })  
3191 -  
3192 - if (th.data.goodsInputNum > redis_num) {  
3193 - wx.showModal({  
3194 - title: '提示',  
3195 - content: '超出商品活动库存'  
3196 - });  
3197 -  
3198 - th.setData({ goodsInputNum: redis_num })  
3199 -  
3200 - return false;  
3201 - }  
3202 - }  
3203 -  
3204 - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);  
3205 - if (th.data.goodsInputNum > o.store_count) {  
3206 - th.setData({ goodsInputNum: o.store_count })  
3207 - return s.my_warnning("超出商品库存", 0, th);  
3208 - }  
3209 -  
3210 - if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)  
3211 - this.setData({  
3212 - sto_sele_name: ""  
3213 - });  
3214 - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);  
3215 - //--------------此时操作的数据------------  
3216 - var newd = {  
3217 - goods_id: o.goods_id,  
3218 - goods_num: th.data.goodsInputNum,  
3219 - pick_id: th.data.sto_sele_id,  
3220 - user_id: oo.user_id,  
3221 - store_id: th.data.stoid,  
3222 - goods_price: o.shop_price,  
3223 - goods_name: o.goods_name,  
3224 - goods_sn: o.goods_sn,  
3225 - sku: o.sku,  
3226 - };  
3227 -  
3228 - //---是不是从收藏夹出来的---  
3229 - if (th.data.c_guide_id) {  
3230 - newd['guide_id'] = th.data.c_guide_id;  
3231 - newd['guide_type'] = 2;  
3232 -  
3233 - } else {  
3234 - if (getApp().globalData.guide_id) {  
3235 - newd['guide_id'] = getApp().globalData.guide_id;  
3236 - newd['guide_type'] = 0;  
3237 -  
3238 - }  
3239 - }  
3240 -  
3241 - //让商品带上房间号  
3242 - if (th.data.sys_switch.is_skuroom_id == 1) {  
3243 - if (th.data.data.goods_id == getApp().globalData.room_goods_id) {  
3244 - newd.room_id = getApp().globalData.room_id;  
3245 - }  
3246 - } else {  
3247 - if (newd.goods_id == getApp().globalData.room_goods_id) {  
3248 - newd.room_id = getApp().globalData.room_id;  
3249 - }  
3250 - }  
3251 -  
3252 - //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------  
3253 -  
3254 - if (th.data.is_normal == 1) {  
3255 - var conf = th.data.bconfig;  
3256 - if (conf.switch_list) {  
3257 - var s_list = JSON.parse(conf.switch_list);  
3258 - //如果后台有开启等级价的功能  
3259 - if (parseInt(s_list.rank_switch) == 2) {  
3260 - var card_price = o[getApp().globalData.userInfo['card_field']];  
3261 - //如果会员有等级价  
3262 - if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null  
3263 - && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) {  
3264 - newd.goods_price = card_price;  
3265 - }  
3266 - }  
3267 - }  
3268 - }  
3269 -  
3270 -  
3271 - //-----如果是秒杀,团购,积分购,拼团,且不是普通购买-----  
3272 - if (th.data.prom_type == 6 && th.data.is_normal != 1) {  
3273 - newd.goods_price = th.data.prom_price;  
3274 - newd.prom_type = th.data.prom_type;  
3275 - newd.prom_id = th.data.prom_id;  
3276 - newd.kt_type = th.data.prom_act.kttype; //开团类型  
3277 - newd.is_pt_tz = 0;  
3278 - //th.data.sto_sele_distr=1; //直接用自提的方式提交  
3279 - if (newd.kt_type > 1) {  
3280 - newd.is_pt_tz = 1; //开团类型  
3281 - }  
3282 - if (newd.kt_type == 3) {  
3283 - th.data.sto_sele_distr = 1;  
3284 - }  
3285 -  
3286 - } else if (th.data.prom_type == 3) {  
3287 - newd.prom_type = 0;  
3288 - newd.prom_id = 0;  
3289 - }  
3290 -  
3291 - newd['pick_name'] = th.data.sto_sele_name;  
3292 - newd['pick_dis'] = th.data.sto_sele_distr;  
3293 - newd['is_normal'] = th.data.is_normal;  
3294 -  
3295 - if (newd['is_normal']) {  
3296 - newd['is_pd_normal'] = 1;  
3297 - //判断一下有没有全局优惠活动  
3298 - th.check_nor_promgood(newd.goods_id, function (e) {  
3299 - if (e && e.act_id) {  
3300 - newd['prom_type'] = 3;  
3301 - newd['prom_id'] = e.act_id;  
3302 - }  
3303 - th.buyNow(newd)  
3304 - })  
3305 - }  
3306 - else th.buyNow_pt(newd);  
3307 - })  
3308 - },  
3309 - //----------立即购买_pt-----------  
3310 - buyNow_pt: function (e) {  
3311 - s.set_b_now(e);  
3312 - wx.navigateTo({  
3313 - url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + e.goods_id,  
3314 - });  
3315 - },  
3316 -  
3317 //-------跳转pt商品------- 2591 //-------跳转pt商品-------
3318 go_to_nopay: function () { 2592 go_to_nopay: function () {
3319 var th = this; 2593 var th = this;
@@ -3338,7 +2612,7 @@ Page({ @@ -3338,7 +2612,7 @@ Page({
3338 2612
3339 }, 2613 },
3340 2614
3341 - //---拼团倒计时--- 2615 + //---倒计时---
3342 countDown2() { 2616 countDown2() {
3343 if (!this.data.is_timer) return false; 2617 if (!this.data.is_timer) return false;
3344 var th = this; 2618 var th = this;
@@ -3379,77 +2653,6 @@ Page({ @@ -3379,77 +2653,6 @@ Page({
3379 } 2653 }
3380 setTimeout(th.countDown2, 1000); 2654 setTimeout(th.countDown2, 1000);
3381 }, 2655 },
3382 - //跳转参加团  
3383 - go_cj_team: function (e) {  
3384 - var ind = e.currentTarget.dataset.ind;  
3385 - var item = this.data.teamgroup[ind];  
3386 - var id = item.id;  
3387 - var th = this;  
3388 -  
3389 - getApp().request.get("/api/weshop/order/page", {  
3390 - data: {  
3391 - pt_prom_id: item.team_id,  
3392 - user_id: oo.user_id,  
3393 - store_id: os.stoid,  
3394 - pageSize: 1,  
3395 - page: 1  
3396 - },  
3397 - success: function (e) {  
3398 - if (e.data.code != 0) {  
3399 - getApp().my_warnning("读取订单失败", 0, th);  
3400 - return fasle;  
3401 - }  
3402 - //--跳转到已经购买的情况--  
3403 - if (e.data.data.pageData.length > 0) {  
3404 - var odr = e.data.data.pageData[0];  
3405 - //还未支付  
3406 - if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) {  
3407 - wx.showModal({  
3408 - title: "您已经购买了该商品待支付中",  
3409 - success: function (a) {  
3410 - if (a.confirm) {  
3411 - wx.navigateTo({  
3412 - url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id,  
3413 - });  
3414 - }  
3415 - }  
3416 - });  
3417 - } else if (odr.pt_status == 1 && odr.order_status == 1) {  
3418 -  
3419 - if (this.data.is_go_to_team_show) return false;  
3420 - this.data.is_go_to_team_show = 1;  
3421 - wx.showLoading();  
3422 - /*--  
3423 - wx.redirectTo({  
3424 - url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn,  
3425 - });--*/  
3426 -  
3427 - getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn);  
3428 -  
3429 - } else {  
3430 - wx.navigateTo({  
3431 - url: "/pages/team/team_show/team_show?tg_id=" + id,  
3432 - });  
3433 - }  
3434 - }  
3435 - //--跳转到参团--  
3436 - else {  
3437 - wx.navigateTo({  
3438 - url: "/pages/team/team_show/team_show?tg_id=" + id,  
3439 - });  
3440 - }  
3441 - }  
3442 - })  
3443 -  
3444 - },  
3445 -  
3446 - //跳到团更多  
3447 - go_t_more: function () {  
3448 - var team_id = this.data.prom_id;  
3449 - wx.navigateTo({  
3450 - url: "/pages/team/team_more/team_more?team_id=" + team_id,  
3451 - });  
3452 - },  
3453 2656
3454 //--点赞功能-- 2657 //--点赞功能--
3455 click_zan: function (e) { 2658 click_zan: function (e) {
@@ -3877,8 +3080,6 @@ Page({ @@ -3877,8 +3080,6 @@ Page({
3877 context.setFontSize(22 * unit) 3080 context.setFontSize(22 * unit)
3878 context.fillText("长按识别二维码", 40 * unit, 806 * unit); 3081 context.fillText("长按识别二维码", 40 * unit, 806 * unit);
3879 context.fillText("立即开始兑换", 40 * unit, 846 * unit); 3082 context.fillText("立即开始兑换", 40 * unit, 846 * unit);
3880 -  
3881 -  
3882 } 3083 }
3883 3084
3884 //---二维吗图--- 3085 //---二维吗图---
@@ -4822,56 +4023,6 @@ Page({ @@ -4822,56 +4023,6 @@ Page({
4822 wx.navigateTo({ url: url, }) 4023 wx.navigateTo({ url: url, })
4823 }, 4024 },
4824 4025
4825 - //---检查有没有优惠活动---  
4826 - check_is_youhui: function (gid, is_nor) {  
4827 - var th = this;  
4828 - //如果是普通购买的时候,要进行调用  
4829 - if (is_nor) {  
4830 - getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + gid, {  
4831 - success: function (res) {  
4832 - if (res.data.code == 0) {  
4833 - var r_data = res.data.data;  
4834 - th.setData({  
4835 - prom_goods: r_data.promGoodsLists,  
4836 - })  
4837 - th.is_show_more_buy();  
4838 - }  
4839 - },  
4840 - })  
4841 -  
4842 - } else {  
4843 - //调用接口判断订单优惠,  
4844 - getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0", {  
4845 - success: function (res) {  
4846 - if (res.data.code == 0) {  
4847 - var r_data = res.data.data;  
4848 - var max = 0, min = 0;  
4849 - if (r_data.collocationList) {  
4850 - for (var i in r_data.collocationList) {  
4851 - if (max == 0) max = r_data.collocationList[i].price;  
4852 - if (min == 0) min = r_data.collocationList[i].price;  
4853 -  
4854 - if (max < parseFloat(r_data.collocationList[i].price)) max = r_data.collocationList[i].price;  
4855 - if (min > parseFloat(r_data.collocationList[i].price)) min = r_data.collocationList[i].price;  
4856 - }  
4857 - r_data.collocationPromList.max = (max + th.data.data.shop_price).toFixed(2);  
4858 - r_data.collocationPromList.min = (min + th.data.data.shop_price).toFixed(2);  
4859 - }  
4860 - th.setData({  
4861 - order_prom: r_data.promOrder,  
4862 - collocationGoods: r_data.collocationPromList,  
4863 - prom_goods: r_data.promGoodsLists,  
4864 - })  
4865 - th.is_show_more_buy();  
4866 - }  
4867 - }  
4868 -  
4869 - })  
4870 - }  
4871 -  
4872 -  
4873 - },  
4874 -  
4875 closePoster() { 4026 closePoster() {
4876 this.setData({ 4027 this.setData({
4877 showPoster: false, 4028 showPoster: false,
@@ -5014,29 +4165,6 @@ Page({ @@ -5014,29 +4165,6 @@ Page({
5014 4165
5015 }, 4166 },
5016 4167
5017 - //-- 积分购 --  
5018 - go_pay_integral: function () {  
5019 - this.get_sto(0)  
5020 - this.setData({ openSpecModal_inte: 1, goodsInputNum: 1 });  
5021 - },  
5022 - //-- 积分购普通购买 --  
5023 - go_pay_integral_normal: function () {  
5024 - var th = this;  
5025 - if (th.data.sku_g_pt) {  
5026 - this.get_sto(1)  
5027 - this.setData({ openSpecModal_inte_normal: 1 });  
5028 - } else {  
5029 - th.get_sto(1);  
5030 - th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () {  
5031 - th.setData({  
5032 - is_normal: 1,  
5033 - openSpecModal_inte_normal: 1  
5034 - });  
5035 - });  
5036 - }  
5037 - this.check_is_youhui(th.data.gid, 1);  
5038 - },  
5039 -  
5040 closeSpecModal_inte: function () { 4168 closeSpecModal_inte: function () {
5041 this.setData({ openSpecModal_inte: 0 }); 4169 this.setData({ openSpecModal_inte: 0 });
5042 }, 4170 },
@@ -5053,97 +4181,100 @@ Page({ @@ -5053,97 +4181,100 @@ Page({
5053 }, 4181 },
5054 4182
5055 addCart_inte: function (t) { 4183 addCart_inte: function (t) {
5056 - this.add_cart_func_inte(t);  
5057 - },  
5058 -  
5059 -  
5060 -  
5061 -  
5062 - onShareTimeline() {  
5063 - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';  
5064 - if (!store_name)  
5065 - store_name = getApp().globalData.setting.appName;  
5066 - return {  
5067 - title: this.data.data.goods_name + '-' + store_name,  
5068 - imageUrl: this.data.gallery[0].image_url,  
5069 - } 4184 + this.add_cart_func_inte(t);
5070 }, 4185 },
5071 4186
5072 4187
5073 - clickCollapse() {  
5074 - this.setData({  
5075 - flag: !this.data.flag,  
5076 - })  
5077 - }, 4188 + onShareTimeline() {
  4189 + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
  4190 + if (!store_name)
  4191 + store_name = getApp().globalData.setting.appName;
  4192 + return {
  4193 + title: this.data.data.goods_name + '-' + store_name,
  4194 + imageUrl: this.data.gallery[0].image_url,
  4195 + }
  4196 + },
5078 4197
5079 - clickShare() {  
5080 - this.setData({  
5081 - share_hidden: true,  
5082 - });  
5083 - }, 4198 + clickCollapse() {
  4199 + this.setData({flag: !this.data.flag,})
  4200 + },
5084 4201
5085 - send() {  
5086 - this.setData({  
5087 - share_hidden: false,  
5088 - });  
5089 - }, 4202 + clickShare() {
  4203 + this.setData({share_hidden: true,});
  4204 + },
5090 4205
5091 - cancel() {  
5092 - this.setData({  
5093 - share_hidden: false,  
5094 - });  
5095 - }, 4206 + send() {
  4207 + this.setData({share_hidden: false,});
  4208 + },
5096 4209
5097 - //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动  
5098 - check_nor_promgood(goods_id, back) {  
5099 - getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, {  
5100 - success: function (res) {  
5101 - if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) {  
5102 - var obj = {  
5103 - act_id: res.data.data.promGoodsLists[0].prom_id,  
5104 - }  
5105 - back(obj);  
5106 - } else {  
5107 - back(0)  
5108 - }  
5109 - }  
5110 - })  
5111 - }, 4210 + cancel() {
  4211 + this.setData({
  4212 + share_hidden: false,
  4213 + });
  4214 + },
5112 4215
5113 - go_zh: function (e) {  
5114 - var id = e.currentTarget.dataset.id;  
5115 - getApp().goto("/packageB/pages/zuhegou/index/index?id=" + id);  
5116 - }, 4216 + //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动
  4217 + check_nor_promgood(goods_id, back) {
  4218 + getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, {
  4219 + success: function (res) {
  4220 + if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) {
  4221 + var obj = {
  4222 + act_id: res.data.data.promGoodsLists[0].prom_id,
  4223 + }
  4224 + back(obj);
  4225 + } else {
  4226 + back(0)
  4227 + }
  4228 + }
  4229 + })
  4230 + },
5117 4231
5118 - check_zh_acting: function (func) {  
5119 - var isok = 1, item = this.data.sele_g;  
5120 - //如果有组合购  
5121 - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.userInfo.user_id;  
5122 - getApp().request.promiseGet(url, {}).then(res => {  
5123 - if (res.data.code == 0 && res.data.data) {  
5124 - if (res.data.data.is_show != 1) {  
5125 - isok = 0; 4232 + async get_pre_prom(func){
  4233 + var th = this;
  4234 + var presell_id = null;
  4235 + var pre_arr = null;
  4236 + //------获取预售从表----------
  4237 + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => {
  4238 + if (res.data.code == 0 && res.data.data) {
  4239 + var arr = res.data.data;
  4240 + presell_id = arr.presell_id;
  4241 + th.setData({
  4242 + presellList: arr,
  4243 + })
  4244 + }
  4245 + })
  4246 + if (!presell_id) {
  4247 + wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000})
  4248 + return false;
5126 } 4249 }
5127 - //如果活动已经结束  
5128 - if (res.data.data.is_end == 1) {  
5129 - isok = 0; 4250 + //------获取预售主表----------
  4251 + await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => {
  4252 + if (res.data.code == 0 && res.data.data) {
  4253 + th.setData({
  4254 + presellForm: res.data.data,
  4255 + });
  4256 + th.countDown(res.data.data.end_time)
  4257 + }
  4258 + })
  4259 + var userInfo = getApp().globalData.userInfo;
  4260 + var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid};
  4261 + if (userInfo) {
  4262 + pre_data.user_id = userInfo.user_id;
5130 } 4263 }
5131 - //已经结束  
5132 - if (ut.gettimestamp() > res.data.data.end_time) {  
5133 - isok = 0; 4264 + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
  4265 + data: pre_data,
  4266 + }).then(e => {
  4267 + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
  4268 + pre_arr = e.data.data.pageData[0];
  4269 + th.setData({pre_arr: pre_arr})
  4270 + }
  4271 + })
  4272 + if (!pre_arr) {
  4273 + wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000})
5134 } 4274 }
5135 - //还未开始  
5136 - if (ut.gettimestamp() < res.data.data.start_time) {  
5137 - isok = 0; 4275 + if (func) {
  4276 + func();
5138 } 4277 }
5139 -  
5140 - } else {  
5141 - //未找到商品的活动  
5142 - isok = 0;  
5143 - }  
5144 - item.act = res.data.data;  
5145 - func(isok);  
5146 - })  
5147 - } 4278 + }
5148 4279
5149 }); 4280 });
packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -151,7 +151,7 @@ @@ -151,7 +151,7 @@
151 </view> 151 </view>
152 <block wx:else> 152 <block wx:else>
153 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> 153 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
154 - (配送不匹配) 154 + (配送不匹配2)
155 </view> 155 </view>
156 <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> 156 <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">
157 (库存不足) 157 (库存不足)
@@ -494,10 +494,8 @@ @@ -494,10 +494,8 @@
494 <view>购物车</view> 494 <view>购物车</view>
495 </navigator> 495 </navigator>
496 </view> 496 </view>
497 - <view bindtap="openSpecModel" class="buy-btn cart-btn cart-btn-lg" wx:if="{{data.goods.is_virtual}}">  
498 - 立即购买  
499 - </view>  
500 - <view class="fs24 f1 flex ai-center bg-FF4732 t-c white"> 497 +
  498 + <view class="fs24 f1 flex ai-center bg-FF4732 t-c white" style="border-radius:10rpx ">
501 <view class="pdh20"> 499 <view class="pdh20">
502 <view class="">{{filters.format_time(presellForm.end_time,2)}} 预售结束</view> 500 <view class="">{{filters.format_time(presellForm.end_time,2)}} 预售结束</view>
503 <!-- <view class="">08.30 23:59:59 开始发货</view> --> 501 <!-- <view class="">08.30 23:59:59 开始发货</view> -->
@@ -527,20 +525,13 @@ @@ -527,20 +525,13 @@
527 <view class="spec-goods-info"> 525 <view class="spec-goods-info">
528 <view class="spec-goods-name ellipsis-2">{{sele_g.goods_name}}</view> 526 <view class="spec-goods-name ellipsis-2">{{sele_g.goods_name}}</view>
529 <view class="flex ai_end xc-val-money"> 527 <view class="flex ai_end xc-val-money">
530 - <view class="spec-goods-price" wx:if="{{prom_price==null}}">  
531 - <text class="fs20">¥</text>  
532 - <!-- 如果是等级会员,且有等级价 -->  
533 - <block wx:if="{{card_field && sele_g[card_field]>0}}">{{sele_g[card_field]}}</block>  
534 - <block wx:else>{{sele_g.shop_price}}</block>  
535 - </view>  
536 - <view class="spec-goods-price tag" wx:else>  
537 - <text class="fs20">¥</text>  
538 - {{prom_price}} 528 +
  529 + <view class="spec-goods-price tag">
  530 + <text class="fs20">¥</text>{{presellList.presell_money}}
539 </view> 531 </view>
540 <!-- 显示线下价格 --> 532 <!-- 显示线下价格 -->
541 <view wx:if="{{sele_g.offline_price}}" class="quan_price flex ai-center jc-center"> 533 <view wx:if="{{sele_g.offline_price}}" class="quan_price flex ai-center jc-center">
542 - 券后¥  
543 - <text class="fs32">{{sele_g.offline_price}}</text> 534 + 券后¥<text class="fs32">{{sele_g.offline_price}}</text>
544 </view> 535 </view>
545 </view> 536 </view>
546 <block wx:if="{{prom_type==0}}"> 537 <block wx:if="{{prom_type==0}}">
@@ -589,7 +580,7 @@ @@ -589,7 +580,7 @@
589 <block wx:else> 580 <block wx:else>
590 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 581 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
591 <block wx:else> 582 <block wx:else>
592 - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> 583 + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配1)</view>
593 <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> 584 <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">
594 (库存不足) 585 (库存不足)
595 </view> 586 </view>
@@ -631,27 +622,21 @@ @@ -631,27 +622,21 @@
631 </view> 622 </view>
632 </view> 623 </view>
633 <view class="spec-cart-btns"> 624 <view class="spec-cart-btns">
634 - <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn fs32" data-action="add" style="background-color:#FF4835;color:white;" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" data-action="buy">  
635 - 支付定金(¥9.9) 625 + <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn fs32" data-action="add" >
  626 + 门店的不匹配
636 </view> 627 </view>
637 <block wx:else> 628 <block wx:else>
638 <!-- 根本就找不到门店 --> 629 <!-- 根本就找不到门店 -->
639 <block wx:if="{{!only_pk && !def_pickpu_list}}"> 630 <block wx:if="{{!only_pk && !def_pickpu_list}}">
640 - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">  
641 - 库存不足  
642 - </view> 631 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">未找到门店</view>
643 </block> 632 </block>
644 <block wx:else> 633 <block wx:else>
645 <block wx:if="{{only_pk.length && !only_pk.length}}"> 634 <block wx:if="{{only_pk.length && !only_pk.length}}">
646 - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">  
647 - 库存不足  
648 - </view> 635 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">未找到门店</view>
649 </block> 636 </block>
650 <block wx:else> 637 <block wx:else>
651 <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> 638 <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">
652 - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">  
653 - 库存不足  
654 - </view> 639 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">未找到门店</view>
655 </block> 640 </block>
656 <block wx:else> 641 <block wx:else>
657 <block wx:if="{{!def_pick_store}}"> 642 <block wx:if="{{!def_pick_store}}">
@@ -660,44 +645,26 @@ @@ -660,44 +645,26 @@
660 </view> 645 </view>
661 </block> 646 </block>
662 <block wx:else> 647 <block wx:else>
663 - <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 -->  
664 - <block wx:if="{{sales_rules==2 && prom_type==0}}">  
665 - <block wx:if="{{!def_pick_store.CanOutQty}}">  
666 - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">  
667 - 库存不足  
668 - </view>  
669 - </block>  
670 - <block wx:else>  
671 - <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32" data-action="add">  
672 - 加入购物车  
673 - </view>  
674 - <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy">  
675 - {{sele_g.offline_price?"券后购买":"立即购买"}}  
676 - </view>  
677 - </block>  
678 - </block>  
679 - <!-- 线上销售 -->  
680 - <block wx:else> 648 +
  649 + <!-- 线上销售 -->
681 <block wx:if="{{sele_g.store_count<=0}}"> 650 <block wx:if="{{sele_g.store_count<=0}}">
682 - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">  
683 - 库存不足  
684 - </view> 651 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
685 </block> 652 </block>
686 <block wx:else> 653 <block wx:else>
687 - <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32" data-action="add">  
688 - 加入购物车  
689 - </view>  
690 - <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy">  
691 - {{sele_g.offline_price?"券后购买":"立即购买"}} 654 + <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart"
  655 + data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy">
  656 + 支付定金(¥{{presellList.presell_money}})
692 </view> 657 </view>
693 </block> 658 </block>
694 - </block> 659 +
695 </block> 660 </block>
696 </block> 661 </block>
697 </block> 662 </block>
698 </block> 663 </block>
699 </block> 664 </block>
700 </view> 665 </view>
  666 +
  667 +
701 <view class="clear"></view> 668 <view class="clear"></view>
702 <!-- 选择门店的列表 --> 669 <!-- 选择门店的列表 -->
703 <view hidden="{{ismend==0}}" class="sto_v"> 670 <view hidden="{{ismend==0}}" class="sto_v">
@@ -746,38 +713,7 @@ @@ -746,38 +713,7 @@
746 </view> 713 </view>
747 </view> 714 </view>
748 </view> 715 </view>
749 -<!-- --弹起的-- -->  
750 -<block wx:if="{{pd_xx==1}}">  
751 - <view class="bview"></view>  
752 - <view class="juzhong">  
753 - <view class="xq">  
754 - <view class="title" bindtap="close_pt_xx">  
755 - 拼团玩法介绍  
756 - <image src="{{iurl}}/miniapp/images/gbi.png" class="close"></image>  
757 - </view>  
758 - <view>  
759 - 1.开团:  
760 - <text class="hs1">选择心仪商品,点击“发起X人团”按钮,付款后即为开团成功;</text>  
761 - </view>  
762 - <view>  
763 - 2.参团:  
764 - <text class="hs1">进入朋友分享的页面,点击“立即参团”按钮,付款后即为参团成功,若多人同时支付,支付成功时间较早的人获得参团资格;</text>  
765 - </view>  
766 - <view>  
767 - 3.成团:  
768 - <text class="hs1">在开团或参团成功后,点击“邀请小伙伴参团”将页面分享给好友,在有效时间内凑齐人数即为成团,此时商家会开始发货;</text>  
769 - </view>  
770 - <view>  
771 - 4.组团失败:  
772 - <text class="hs1">在有效时间内未凑齐人数,即为组团失败,此时付款项会原路退回到支付账户;</text>  
773 - </view>  
774 - <view>  
775 - 5.  
776 - <text class="hs1">组团有效期间内,拼购商品订单不允许取消。</text>  
777 - </view>  
778 - </view>  
779 - </view>  
780 -</block> 716 +
781 <!-- --弹起领券-- --> 717 <!-- --弹起领券-- -->
782 <view wx:if='{{coupon==1}}'> 718 <view wx:if='{{coupon==1}}'>
783 <view class="cover-layer flex-center" data-coupon='0' bindtap="switchCoupon"></view> 719 <view class="cover-layer flex-center" data-coupon='0' bindtap="switchCoupon"></view>
@@ -985,10 +921,7 @@ @@ -985,10 +921,7 @@
985 <text class="iconfont icon-close"></text> 921 <text class="iconfont icon-close"></text>
986 </view> 922 </view>
987 </view> 923 </view>
988 - <!-- <view class="btn-container">  
989 - <button class="btn-share" open-type="share" bindtap="">微信好友分享</button>  
990 - <button class="btn-share" bindtap="savePic">保存到相册</button>  
991 - </view> --> 924 +
992 </view> 925 </view>
993 </view> 926 </view>
994 </view> 927 </view>
995 \ No newline at end of file 928 \ No newline at end of file
packageC/pages/presell/list/list.js
@@ -17,10 +17,8 @@ Page({ @@ -17,10 +17,8 @@ Page({
17 onLoad: function (t) { 17 onLoad: function (t) {
18 var first_leader = t.first_leader; 18 var first_leader = t.first_leader;
19 var th = this; 19 var th = this;
20 -  
21 - console.log("------------");  
22 - console.log(first_leader);  
23 getApp().getConfig(); 20 getApp().getConfig();
  21 + this.data.act_id=t.act_id;
24 22
25 if (first_leader) { 23 if (first_leader) {
26 getApp().globalData.first_leader = first_leader; 24 getApp().globalData.first_leader = first_leader;
@@ -52,10 +50,26 @@ Page({ @@ -52,10 +50,26 @@ Page({
52 } 50 }
53 }) 51 })
54 52
55 - //调用列表  
56 - this.get_list(); 53 + var userInfo=getApp().globalData.userInfo;
  54 + if(userInfo && goodlist.length==0){
  55 + //调用列表
  56 + this.get_list();
  57 + }else{
  58 + getApp().goto("/pages/togoin/togoin");
  59 + }
  60 + },
  61 + onShow: function (t) {
  62 + var userInfo=getApp().globalData.userInfo;
  63 + if(userInfo && this.data.goodlist.length==0){
  64 + //调用列表
  65 + this.get_list();
  66 + }else{
  67 + if(getApp().globalData.pre_back==1){
  68 + getApp().globalData.pre_back=0;
  69 + getApp().goto("/pages/index/index/index");
  70 + }
  71 + }
57 }, 72 },
58 - onShow: function (t) { },  
59 //---小于10的格式化函数---- 73 //---小于10的格式化函数----
60 timeFormat(param) { 74 timeFormat(param) {
61 return param < 10 ? '0' + param : param; 75 return param < 10 ? '0' + param : param;
@@ -105,7 +119,13 @@ Page({ @@ -105,7 +119,13 @@ Page({
105 pageSize: 10, 119 pageSize: 10,
106 timetype: 1 120 timetype: 1
107 } 121 }
108 - 122 + if(getApp().globalData.userInfo){
  123 + req.user_id=getApp().globalData.userInfo.user_id;
  124 + }
  125 + if(this.data.act_id){
  126 + req.prom_type=8;
  127 + req.prom_id=this.data.act_id;
  128 + }
109 //调用接口获取数据 129 //调用接口获取数据
110 getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { 130 getApp().request.get("/api/weshop/marketing/marketingPresellList/page", {
111 data: req, 131 data: req,
@@ -132,6 +152,9 @@ Page({ @@ -132,6 +152,9 @@ Page({
132 } 152 }
133 }) 153 })
134 }, 154 },
  155 + go_index:function () {
  156 + getApp().goto("/pages/index/index/index");
  157 + }
135 158
136 159
137 }); 160 });
packageC/pages/presell/list/list.wxml
@@ -32,12 +32,13 @@ @@ -32,12 +32,13 @@
32 32
33 <view class="kill-list seckill_list"> 33 <view class="kill-list seckill_list">
34 <view class="kill-item" wx:for="{{goodlist}}"> 34 <view class="kill-item" wx:for="{{goodlist}}">
35 - <navigator class="kill-pic rel" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> 35 + <navigator class="kill-pic rel" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">
36 <image class="wh100" src="{{url+item.original_img}}" data-val="{{item.original_img}}" 36 <image class="wh100" src="{{url+item.original_img}}" data-val="{{item.original_img}}"
37 data-errorimg="goodlist[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> 37 data-errorimg="goodlist[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image>
38 </navigator> 38 </navigator>
39 <view class="kill-cont"> 39 <view class="kill-cont">
40 - <navigator class="goods-name ellipsis-2" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}">{{item.goods_name}}</navigator> 40 + <navigator class="goods-name ellipsis-2"
  41 + url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">{{item.goods_name}}</navigator>
41 <view class="flex-vertical xc-strip-frame"> 42 <view class="flex-vertical xc-strip-frame">
42 <view class="xc-strip-blank rel"> 43 <view class="xc-strip-blank rel">
43 44
@@ -68,11 +69,13 @@ @@ -68,11 +69,13 @@
68 </view> 69 </view>
69 </view> 70 </view>
70 71
  72 + <block wx:if="{{goodlist.length==0 && is_get}}">
  73 + <nodata nodataContainer="t-c"></nodata>
  74 + <view class="bc_btn" bindtap="go_index">去首页逛逛</view>
  75 + </block>
  76 + <view class="no-more" wx:elif="{{no_more}}">-- 没有更多 --</view>
71 77
72 -<nodata wx:if="{{goodlist.length==0 && is_get}}" nodataContainer="t-c"></nodata>  
73 -<view class="no-more" wx:elif="{{no_more}}">-- 没有更多 --</view>  
74 -  
75 - <view style="height:10rpx"></view> 78 + <view style="height:10rpx"></view>
76 </view> 79 </view>
77 80
78 81
packageC/pages/presell/list/list.wxss
@@ -191,5 +191,15 @@ border-radius:20rpx;height:26rpx; @@ -191,5 +191,15 @@ border-radius:20rpx;height:26rpx;
191 .xc-fill-text{ 191 .xc-fill-text{
192 left:34%; 192 left:34%;
193 line-height: 26rpx; 193 line-height: 26rpx;
  194 +}
194 195
  196 +.bc_btn{
  197 + margin: 10rpx auto;
  198 + width: 200rpx;
  199 + height: 60rpx;
  200 + text-align: center;
  201 + line-height: 60rpx;
  202 + background-color: #ff0000;
  203 + color: #fff;
  204 + border-radius: 10rpx;
195 } 205 }
196 \ No newline at end of file 206 \ No newline at end of file