Commit 3bf779ef56e2a1d54d4d4ab8249cdec724d25351

Authored by 后端研发-苏明海
2 parents 76a8a457 1cf8d03e

Merge branch 'qa' into 'master'

Qa

See merge request !413
pages/cart/cart2/cart2.js
1 var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"), 1 var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"),
2 - s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp(); 2 + s = require("../../../utils/util.js"),ut=s, o = require("../../../utils/md5.js"), to = getApp();
3 var oo=t.globalData.setting,os=oo; 3 var oo=t.globalData.setting,os=oo;
4 var regeneratorRuntime = require('../../../utils/runtime.js'); 4 var regeneratorRuntime = require('../../../utils/runtime.js');
5 var util_pay = require("../../../utils/pay.js"); 5 var util_pay = require("../../../utils/pay.js");
@@ -85,8 +85,17 @@ Page({ @@ -85,8 +85,17 @@ Page({
85 is_shipping_code:"",//插入用户默认地址 85 is_shipping_code:"",//插入用户默认地址
86 wu_arr_txt:"", //要更新的物流的字段 86 wu_arr_txt:"", //要更新的物流的字段
87 87
88 - sales_rules:1, //默认是显示线上库存  
89 - 88 + sales_rules:1, //默认是显示线上库存
  89 + isget_by_quan:{}, //是否调用了接口获取包邮券
  90 + get_by_quan_list:null, //立即购买的
  91 + get_by_quan_list_cart:{}, //购物车的
  92 + by_quan_list_cart:null, //点击选择的包邮列表
  93 +
  94 + //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券
  95 + is_no_by:{},
  96 + is_by:{},
  97 + is_quan_by:{},
  98 +
90 }, 99 },
91 onLoad: function(t) { 100 onLoad: function(t) {
92 101
@@ -111,6 +120,13 @@ Page({ @@ -111,6 +120,13 @@ Page({
111 120
112 }, 121 },
113 onUnload: function () { this.setData({ isclose: 1 })}, 122 onUnload: function () { this.setData({ isclose: 1 })},
  123 + onHide: function () {
  124 + this.setData({
  125 + isget_by_quan:{},
  126 + is_no_by:{},
  127 + is_by:{}
  128 + })
  129 + },
114 130
115 //----------子页返回父页触发---------- 131 //----------子页返回父页触发----------
116 onShow: function() { 132 onShow: function() {
@@ -454,11 +470,26 @@ Page({ @@ -454,11 +470,26 @@ Page({
454 var umoney = th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money; 470 var umoney = th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money;
455 471
456 var freight_free = ee.freight_free; //全场满多少包邮 472 var freight_free = ee.freight_free; //全场满多少包邮
457 - var c_arr=th.data.cartlist; 473 + var no_ex_id=ee.no_ex_id;
  474 + var no_ex_good=null;
  475 + var by_qc={};
  476 +
  477 + if(no_ex_id && freight_free>0){
  478 + //-----------获取不包邮区域,不包邮商品-------
  479 + await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods",{
  480 + data:{store_id:os.stoid,id:no_ex_id}
  481 + }).then(res=>{
  482 + if(res.data.code==0){
  483 + by_qc=res.data.data[0];
  484 + }
  485 + })
  486 + }
458 487
  488 + var c_arr=th.data.cartlist;
459 //---循环购物车--- 489 //---循环购物车---
460 for(var i=0;i<c_arr.length;i++){ 490 for(var i=0;i<c_arr.length;i++){
461 var cart_item=c_arr[i]; 491 var cart_item=c_arr[i];
  492 + var pickid=cart_item.pickup_id;
462 var o_price=0; 493 var o_price=0;
463 var o_shipping_price=0,goods_weight=-1, goods_piece=-1; 494 var o_shipping_price=0,goods_weight=-1, goods_piece=-1;
464 var item=c_arr[i].goods; 495 var item=c_arr[i].goods;
@@ -466,37 +497,141 @@ Page({ @@ -466,37 +497,141 @@ Page({
466 497
467 //--------循环计算总价----------- 498 //--------循环计算总价-----------
468 for(var j=0;j<item.length;j++){ 499 for(var j=0;j<item.length;j++){
469 - o_price += item[j].goods_price * item[j].goods_num;  
470 - th.data.cartlist[i].goods_price = o_price.toFixed(2); //商品总费用  
471 - //计算物流费用  
472 - th.data.cartlist[i].shipping_price = 0;  
473 - //----------------如果是选择了物流---------------------  
474 - if (c_arr[i].exp_type == 0 && item[j].is_free_shipping==0){  
475 - //如果地址不为空  
476 - if (th.data.user_addr!=null){  
477 - switch (item[j]['exp_sum_type']) {  
478 - case 1:  
479 - //统一运费  
480 - o_shipping_price += item[j]['uniform_exp_sum'];break;  
481 - case 2:  
482 - if (goods_weight < 0) goods_weight = 0;  
483 - //累积商品重量 每种商品的重量 * 数量  
484 - goods_weight += item[j]['weight'] * item[j]['goods_num']; break;  
485 - case 3:  
486 - if (goods_piece < 0) goods_piece = 0;  
487 - //累积商品数量  
488 - goods_piece += item[j]['goods_num'];break;  
489 - } 500 + o_price += item[j].goods_price * item[j].goods_num;
  501 + }
  502 +
  503 + th.data.cartlist[i].goods_price = o_price.toFixed(2); //商品总费用
  504 + //计算物流费用
  505 + th.data.cartlist[i].shipping_price = 0;
  506 +
  507 + //--有不包邮区域,且不免运费,全场的计算--
  508 + if(no_ex_id && freight_free>0 && o_price>freight_free && c_arr[i].exp_type == 0 && (by_qc.region_list || by_qc.goods_list) ){
  509 + //如果有设置不包邮区域的时候
  510 + if(by_qc.region_list!="" && by_qc.region_list!=null && by_qc.region_list!=undefined ){
  511 + if(th.check_by_area(by_qc.region_list)){
  512 + freight_free=0;
  513 + th.data.is_no_by[pickid]=1;
490 } 514 }
491 } 515 }
  516 + //如果有设置不包邮区商品
  517 + if(by_qc.goods_list!="" && by_qc.goods_list!=undefined && by_qc!=null && freight_free>0){
  518 + no_ex_good=by_qc.goods_list;
  519 + }
  520 + }
  521 +
  522 + //--如果是物流,且选择了地址,就要开始显示包邮券--
  523 + if (c_arr[i].exp_type == 0 && th.data.user_addr != null) {
  524 + //看是不是有调用过包邮券
  525 + if(!th.data.isget_by_quan[pickid]){
  526 + //--判断要不要显示包邮券,链式调用接口---
  527 + getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{
  528 + data:{store_id:os.stoid,isuse:0,condition:o_price,user_id:getApp().globalData.user_id,pageSize:2000}
  529 + }).then(res=>{
  530 + if(res.data.code==0 && res.data.data.total>0){
  531 + //此时要循环判断包邮的地区,不包邮商品是不是符合
  532 + var arr=[],quanlist=res.data.data.pageData;
  533 + quanlist = th.check_is_frozenQuan(quanlist, th.data.frozenQuan,1);
  534 + for(var i in quanlist){
  535 + var item=quanlist[i];
  536 + var goods=cart_item.goods;
  537 + var g_arr=[];
  538 + for(var ii in goods){
  539 + g_arr.push(goods[ii].goods_id);
  540 + }
  541 +
  542 + if(item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域
  543 + if(item.goods_list){
  544 + var no_goods_arr=item.goods_list.split(",");
  545 + if(ut.isContained(no_goods_arr,g_arr)) continue; //如果是不包邮商品
  546 + }
  547 + arr.push(item);
  548 + }
  549 + if(arr){
  550 + th.data.get_by_quan_list_cart[pickid]=arr;
  551 + th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart});
  552 + }
  553 + th.data.isget_by_quan[pickid]=1;
  554 + }
  555 + })
  556 + }
  557 + }
  558 +
  559 + var quan_no=null;
  560 + if(th.data.using_quan[pickid])quan_no=th.data.using_quan[pickid].coupon_no;
  561 + //如果是包邮券的时候,要看看券的情况
  562 + if(quan_no && th.data.using_quan[pickid].isby==1){
  563 + var quan=th.data.using_quan[pickid];
  564 + if(!quan.goods_list){
  565 + th.data.is_quan_by[pickid]=1; //专门给券的判断用的
  566 + }else{
  567 + th.data.is_quan_by[pickid]=0;
  568 + //看有没有模板的包邮
  569 + if(no_ex_good){
  570 + var arr=no_ex_good.split(",");
  571 + var arr2=quan.goods_list.split(",");
  572 + if(ut.isContained(arr,arr2)){
  573 + getApp().my_warnning("全场不包邮商品和包邮券的重复",0,th);
  574 + th.data.using_quan[pickid]={};
  575 + th.setData({using_quan:th.data.using_quan})
  576 + return false;
  577 + }
  578 + var n_arr=ut.mergeArray(arr,arr2);
  579 + no_ex_good=n_arr.join(",");
  580 + }else{
  581 + no_ex_good=quan.goods_list;
  582 + }
  583 + }
  584 + }else{
  585 + th.data.is_quan_by[pickid]=0; //专门给券的判断用的
492 } 586 }
493 587
  588 + //--------循环计算总价-----------
  589 + for(var j=0;j<item.length;j++){
  590 + //如果都包邮,都没必要等级数量了
  591 + if(th.data.is_quan_by[pickid]) continue;
  592 + //是不是不包邮的商品
  593 + var is_good_no_by=0;
  594 + if(no_ex_good){
  595 + is_good_no_by=th.check_by_goods(no_ex_good,item[j].goods_id);
  596 + }
  597 + //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮
  598 + if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1) continue;
  599 + //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算--
  600 + if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1 && !is_good_no_by) continue;
  601 +
  602 + //----------------如果是选择了物流---------------------
  603 + if (c_arr[i].exp_type == 0 && item[j].is_free_shipping==0){
  604 + //如果地址不为空
  605 + if (th.data.user_addr!=null){
  606 + switch (item[j]['exp_sum_type']) {
  607 + case 1:
  608 + //统一运费
  609 + o_shipping_price += item[j]['uniform_exp_sum'];break;
  610 + case 2:
  611 + if (goods_weight < 0) goods_weight = 0;
  612 + //累积商品重量 每种商品的重量 * 数量
  613 + goods_weight += item[j]['weight'] * item[j]['goods_num']; break;
  614 + case 3:
  615 + if (goods_piece < 0) goods_piece = 0;
  616 + //累积商品数量
  617 + goods_piece += item[j]['goods_num'];break;
  618 + }
  619 + }
  620 + }
  621 + }
  622 +
  623 +
494 //计算物流价格 624 //计算物流价格
495 if (c_arr[i].exp_type == 0) { 625 if (c_arr[i].exp_type == 0) {
  626 + freight_free=0; //后面不在进行判断
496 var code = th.data.wu_arr[c_arr[i].wind].code; 627 var code = th.data.wu_arr[c_arr[i].wind].code;
497 th.data.cartlist[i].shipping_price = 628 th.data.cartlist[i].shipping_price =
498 th.calculatewuliu(code, o_shipping_price, goods_weight, 629 th.calculatewuliu(code, o_shipping_price, goods_weight,
499 goods_piece,th.data.user_addr, freight_free, o_price, rs); 630 goods_piece,th.data.user_addr, freight_free, o_price, rs);
  631 +
  632 + if(!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby!=1){
  633 + if( th.data.cartlist[i].shipping_price ==0) th.data.is_by[pickid]=0; //已经全场包邮,就不要选择券了
  634 + }
500 }else{ 635 }else{
501 th.data.cartlist[i].shipping_price=0; 636 th.data.cartlist[i].shipping_price=0;
502 } 637 }
@@ -504,26 +639,33 @@ Page({ @@ -504,26 +639,33 @@ Page({
504 th.data.cartlist[i].shipping_price=th.data.cartlist[i].shipping_price.toFixed(2); 639 th.data.cartlist[i].shipping_price=th.data.cartlist[i].shipping_price.toFixed(2);
505 //---如果有选择优惠券的情况下--- 640 //---如果有选择优惠券的情况下---
506 var quan_price=0; 641 var quan_price=0;
507 - var coupon_price=0,bn_pick=th.data.bn_pick,pickid=cart_item.pickup_id;  
508 - console.log("calculatePrice--quan"); 642 + var coupon_price=0;
509 var quan_no= null; 643 var quan_no= null;
510 644
511 if(th.data.using_quan[pickid]!=null && th.data.using_quan[pickid]!=undefined) 645 if(th.data.using_quan[pickid]!=null && th.data.using_quan[pickid]!=undefined)
512 quan_no=th.data.using_quan[pickid].coupon_no; 646 quan_no=th.data.using_quan[pickid].coupon_no;
513 647
514 if(quan_no){ 648 if(quan_no){
515 - //---获取优惠券优惠---  
516 - await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice",{  
517 - data:{storeId:oo.stoid,CashRepNo:quan_no, WaresSum:cart_item.check_quan_price_list, WareIds:cart_item.check_quan_ware_list}  
518 - }).then(res=>{  
519 - if(res.data.code==0 && res.data.data.length>0){  
520 - var q_data=res.data.data; 649 + //如果不是包邮券的时候
  650 + if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby!=1) {
  651 + //---获取优惠券优惠---
  652 + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", {
  653 + data: {
  654 + storeId: oo.stoid,
  655 + CashRepNo: quan_no,
  656 + WaresSum: cart_item.check_quan_price_list,
  657 + WareIds: cart_item.check_quan_ware_list
  658 + }
  659 + }).then(res => {
  660 + if (res.data.code == 0 && res.data.data.length > 0) {
  661 + var q_data = res.data.data;
521 //--存储商品优惠的内容-- 662 //--存储商品优惠的内容--
522 - th.data.cartlist[i].quan_youhui_list=q_data;  
523 - for(var k in q_data )  
524 - quan_price+=q_data[k].WareCashSum;  
525 - }  
526 - }) 663 + th.data.cartlist[i].quan_youhui_list = q_data;
  664 + for (var k in q_data)
  665 + quan_price += q_data[k].WareCashSum;
  666 + }
  667 + })
  668 + }
527 } 669 }
528 670
529 //总价计算,总价不包含运费 671 //总价计算,总价不包含运费
@@ -559,6 +701,8 @@ Page({ @@ -559,6 +701,8 @@ Page({
559 701
560 if (coupon_price>0) th.data.cartlist[i].coupon_price=coupon_price.toFixed(2); 702 if (coupon_price>0) th.data.cartlist[i].coupon_price=coupon_price.toFixed(2);
561 else th.data.cartlist[i].coupon_price = coupon_price 703 else th.data.cartlist[i].coupon_price = coupon_price
  704 + if(quan_no) th.data.cartlist[i].quan_no = quan_no;
  705 +
562 706
563 th.data.cartlist[i].goods_price = o_price.toFixed(2); 707 th.data.cartlist[i].goods_price = o_price.toFixed(2);
564 th.data.cartlist[i].order_amount= th.data.cartlist[i].order_amount- th.data.cartlist[i].user_money; //会员使用余额 708 th.data.cartlist[i].order_amount= th.data.cartlist[i].order_amount- th.data.cartlist[i].user_money; //会员使用余额
@@ -591,13 +735,10 @@ Page({ @@ -591,13 +735,10 @@ Page({
591 th.setData({ [atxt]: all_total_m, [atxt1]: all_order_m, 735 th.setData({ [atxt]: all_total_m, [atxt1]: all_order_m,
592 [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, [atxt5]: all_coupon_price_m }) 736 [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, [atxt5]: all_coupon_price_m })
593 737
594 - console.log('formData',th.data.formData);  
595 - console.log("------------------------");  
596 738
597 }); 739 });
598 }); 740 });
599 }, 741 },
600 -  
601 //---------计算立即购买---------- 742 //---------计算立即购买----------
602 calculatePrice2: function () { 743 calculatePrice2: function () {
603 744
@@ -615,6 +756,31 @@ Page({ @@ -615,6 +756,31 @@ Page({
615 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 756 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
616 //-----------当地址不为空,且是物流时,计算物流费用---------- 757 //-----------当地址不为空,且是物流时,计算物流费用----------
617 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 ){ 758 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 ){
  759 +
  760 + //看是不是有调用过包邮券
  761 + if(!th.data.isget_by_quan[th.data.bn_pick]){
  762 + //--判断要不要显示包邮券,链式调用接口---
  763 + getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{
  764 + data:{store_id:os.stoid,isuse:0,condition:allpice,user_id:getApp().globalData.user_id,pageSize:2000}
  765 + }).then(res=>{
  766 + if(res.data.code==0 && res.data.data.total>0){
  767 + //此时要循环判断包邮的地区,不包邮商品是不是符合
  768 + var arr=[],quanlist=res.data.data.pageData;
  769 + quanlist = th.check_is_frozenQuan(quanlist, th.data.frozenQuan,1);
  770 + for(var i in quanlist){
  771 + var item=quanlist[i];
  772 + if(item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域
  773 + if(item.goods_list && th.check_by_goods(item.goods_list)) continue; //如果是不包邮商品
  774 + arr.push(item);
  775 + }
  776 + if(arr){
  777 + th.setData({get_by_quan_list:arr});
  778 + }
  779 + th.data.isget_by_quan[th.data.bn_pick]=1;
  780 + }
  781 + })
  782 + }
  783 +
618 switch (good['exp_sum_type']) { 784 switch (good['exp_sum_type']) {
619 case 1: 785 case 1:
620 //统一运费 786 //统一运费
@@ -630,36 +796,74 @@ Page({ @@ -630,36 +796,74 @@ Page({
630 } 796 }
631 797
632 var code = th.data.wu_arr[th.data.index].code; 798 var code = th.data.wu_arr[th.data.index].code;
633 - var freight_free = ee.freight_free; //全场满多少包邮 799 + var freight_free = ee.freight_free; //全场满多少包邮
  800 + var no_ex_id=ee.no_ex_id;
  801 + th.data.is_no_by[th.data.bn_pick]=0;
  802 +
  803 + //有不包邮区域,且不免运费
  804 + if(no_ex_id && freight_free>0 && freight_free<=allpice){
  805 + //-----------获取不包邮区域,不包邮商品-------
  806 + await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods",{
  807 + data:{store_id:os.stoid,id:no_ex_id}
  808 + }).then(res=>{
  809 + if(res.data.code==0){
  810 + //如果有设置不包邮区域的时候
  811 + if(res.data.data[0].region_list){
  812 + if(th.check_by_area(res.data.data[0].region_list)){
  813 + freight_free=0;
  814 + th.data.is_no_by[th.data.bn_pick]=1;
  815 + }
  816 + }
  817 + //如果有设置不包邮商品
  818 + if(res.data.data[0].goods_list && freight_free){
  819 + if(th.check_by_goods(res.data.data[0].goods_list)){
  820 + freight_free=0;
  821 + th.data.is_no_by[th.data.bn_pick]=1;
  822 + }
  823 + }
  824 + }
  825 + })
  826 + }
  827 +
  828 + th.data.is_by[th.data.bn_pick]=0;
  829 + //--------------开始计算物流------------------
634 var shipping_price= 830 var shipping_price=
635 th.calculatewuliu(code, o_shipping_price, goods_weight, 831 th.calculatewuliu(code, o_shipping_price, goods_weight,
636 goods_piece, th.data.user_addr, freight_free, allpice, rs); 832 goods_piece, th.data.user_addr, freight_free, allpice, rs);
  833 + if(shipping_price<=0){
  834 + th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券
  835 + }
637 836
638 shipping_price = parseFloat(shipping_price).toFixed(2); 837 shipping_price = parseFloat(shipping_price).toFixed(2);
639 var wl_txt = "formData.shipping_price"; 838 var wl_txt = "formData.shipping_price";
640 th.setData({ [wl_txt]: shipping_price, }) 839 th.setData({ [wl_txt]: shipping_price, })
641 - 840 +
642 }else{ 841 }else{
643 var wl_txt = "formData.shipping_price"; 842 var wl_txt = "formData.shipping_price";
644 th.setData({ [wl_txt]: 0, }) 843 th.setData({ [wl_txt]: 0, })
645 } 844 }
646 -  
647 //---如果有选择优惠券的情况下--- 845 //---如果有选择优惠券的情况下---
648 var quan_price=0,bn_pick=th.data.bn_pick; 846 var quan_price=0,bn_pick=th.data.bn_pick;
649 -  
650 var quan_no=null; 847 var quan_no=null;
651 if(th.data.using_quan[bn_pick]!=null && th.data.using_quan[bn_pick]!=undefined) 848 if(th.data.using_quan[bn_pick]!=null && th.data.using_quan[bn_pick]!=undefined)
652 quan_no=th.data.using_quan[bn_pick].coupon_no; 849 quan_no=th.data.using_quan[bn_pick].coupon_no;
653 if(quan_no){ 850 if(quan_no){
654 var aa=1; 851 var aa=1;
655 - //---获取优惠券优惠---  
656 - await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice",{  
657 - data:{storeId:oo.stoid,CashRepNo:quan_no, WaresSum:th.data.ckeck_quan_price, WareIds:th.data.check_quan_ware_list}  
658 - }).then(res=>{  
659 - if(res.data.code==0){  
660 - quan_price=res.data.data[0].WareCashSum;  
661 - }  
662 - }) 852 + if(th.data.using_quan[bn_pick].isby==1){
  853 + shipping_price=0;
  854 + var wl_txt = "formData.shipping_price";
  855 + th.setData({ [wl_txt]: 0, })
  856 + }else{
  857 + //---获取优惠券优惠---
  858 + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice",{
  859 + data:{storeId:oo.stoid,CashRepNo:quan_no, WaresSum:th.data.ckeck_quan_price, WareIds:th.data.check_quan_ware_list}
  860 + }).then(res=>{
  861 + if(res.data.code==0){
  862 + quan_price=res.data.data[0].WareCashSum;
  863 + }
  864 + })
  865 + }
  866 +
663 } 867 }
664 //-----------------支付价,优惠券不减物流----------------- 868 //-----------------支付价,优惠券不减物流-----------------
665 var total_m = (parseFloat(allpice)).toFixed(2); 869 var total_m = (parseFloat(allpice)).toFixed(2);
@@ -676,11 +880,9 @@ Page({ @@ -676,11 +880,9 @@ Page({
676 var atxt= "formData.total_amount"; 880 var atxt= "formData.total_amount";
677 th.setData({ [atxt]: total_m, }) 881 th.setData({ [atxt]: total_m, })
678 882
679 -  
680 var txt = "formData.user_money"; 883 var txt = "formData.user_money";
681 var txt2 = "formData.order_amount"; 884 var txt2 = "formData.order_amount";
682 var txt3="formData.coupon_price"; 885 var txt3="formData.coupon_price";
683 -  
684 var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); 886 var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money);
685 //--------------如果使用余额--------------------- 887 //--------------如果使用余额---------------------
686 if (th.data.bn_use_money == 1) { 888 if (th.data.bn_use_money == 1) {
@@ -755,13 +957,15 @@ Page({ @@ -755,13 +957,15 @@ Page({
755 'exp_type': th.data.bn_exp_type, //配送方式 957 'exp_type': th.data.bn_exp_type, //配送方式
756 'order_goods':new Array(), 958 'order_goods':new Array(),
757 }; 959 };
758 -  
759 //组装优惠券的钱 960 //组装优惠券的钱
760 if(th.data.formData.coupon_price){ 961 if(th.data.formData.coupon_price){
761 item.coupon_price=th.data.formData.coupon_price; 962 item.coupon_price=th.data.formData.coupon_price;
762 item.coupon_no=th.data.using_quan[th.data.bn_pick].coupon_no; 963 item.coupon_no=th.data.using_quan[th.data.bn_pick].coupon_no;
763 } 964 }
764 - 965 + if(th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].coupon_no && th.data.using_quan[th.data.bn_pick].isby){
  966 + item.coupon_no=th.data.using_quan[th.data.bn_pick].coupon_no;
  967 + item.coupon_price=0;
  968 + }
765 var gg = to.get_b_now(); 969 var gg = to.get_b_now();
766 var goods={ 970 var goods={
767 'goods_id': gg.goods_id, 971 'goods_id': gg.goods_id,
@@ -847,9 +1051,13 @@ Page({ @@ -847,9 +1051,13 @@ Page({
847 }; 1051 };
848 1052
849 //组装优惠券的钱 1053 //组装优惠券的钱
850 - if(t_item.coupon_price){  
851 - item.coupon_price=t_item.coupon_price;  
852 - item.coupon_no=th.data.using_quan[t_item.pickup_id].coupon_no; 1054 + if(t_item.coupon_price) {
  1055 + item.coupon_price = t_item.coupon_price;
  1056 + item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no;
  1057 + }
  1058 + if(t_item.quan_no) {
  1059 + item.coupon_no = t_item.quan_no;
  1060 + item.coupon_price = 0;
853 } 1061 }
854 1062
855 //-------------让商品添加到商品列表-------------------- 1063 //-------------让商品添加到商品列表--------------------
@@ -1005,7 +1213,6 @@ Page({ @@ -1005,7 +1213,6 @@ Page({
1005 }) 1213 })
1006 1214
1007 }, 1215 },
1008 -  
1009 //---确认线下门店的数量足不足--- 1216 //---确认线下门店的数量足不足---
1010 async check_store_num(goods_id,pick,goods_num,func){ 1217 async check_store_num(goods_id,pick,goods_num,func){
1011 var lock=0,pick_no,plist,erpwareid; 1218 var lock=0,pick_no,plist,erpwareid;
@@ -1048,7 +1255,6 @@ Page({ @@ -1048,7 +1255,6 @@ Page({
1048 } 1255 }
1049 func(isok); 1256 func(isok);
1050 }, 1257 },
1051 -  
1052 1258
1053 useCoupon: function() { 1259 useCoupon: function() {
1054 if (this.data.order.couponNum <= 0) { 1260 if (this.data.order.couponNum <= 0) {
@@ -1065,6 +1271,7 @@ Page({ @@ -1065,6 +1271,7 @@ Page({
1065 }, 1271 },
1066 enterAddressPage: function() { 1272 enterAddressPage: function() {
1067 getApp().globalData.is_cart_old=1; 1273 getApp().globalData.is_cart_old=1;
  1274 + this.data.isget_by_quan={};
1068 this.data.enterAddressPage = !0, wx.navigateTo({ 1275 this.data.enterAddressPage = !0, wx.navigateTo({
1069 url: "/pages/user/address_list/address_list" 1276 url: "/pages/user/address_list/address_list"
1070 }); 1277 });
@@ -1089,6 +1296,17 @@ Page({ @@ -1089,6 +1296,17 @@ Page({
1089 } 1296 }
1090 1297
1091 th.setData({ is_all_zt: iszt }); 1298 th.setData({ is_all_zt: iszt });
  1299 +
  1300 + var ind=t.currentTarget.dataset.ind;
  1301 + var c_item=th.data.cartlist[ind];
  1302 + var pickid=c_item.pickup_id;
  1303 +
  1304 + if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1){
  1305 + th.data.using_quan[pickid]={};
  1306 + th.setData({using_quan:th.data.using_quan});
  1307 + }
  1308 +
  1309 +
1092 } 1310 }
1093 //判断有没有默认的物流地址值 1311 //判断有没有默认的物流地址值
1094 if (def_exp_code != "" && def_exp_code != null && def_exp_code !=undefined) { 1312 if (def_exp_code != "" && def_exp_code != null && def_exp_code !=undefined) {
@@ -1113,9 +1331,18 @@ Page({ @@ -1113,9 +1331,18 @@ Page({
1113 th.setData({ bn_exp_type:ty}); 1331 th.setData({ bn_exp_type:ty});
1114 //当物流为空的时候。 1332 //当物流为空的时候。
1115 if (ty == 0 && th.data.wu_arr==null){ 1333 if (ty == 0 && th.data.wu_arr==null){
  1334 + th.data.isget_by_quan={};
1116 return th.get_wuliu(th.calculatePrice2()); 1335 return th.get_wuliu(th.calculatePrice2());
1117 } 1336 }
1118 1337
  1338 + //--自提就要把包邮券清理掉--
  1339 + if(ty==1){
  1340 + th.data.isget_by_quan={};
  1341 + if(th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby==1){
  1342 + th.setData({using_quan:{}});
  1343 + }
  1344 + }
  1345 +
1119 //判断有没有默认的物流地址值 1346 //判断有没有默认的物流地址值
1120 if (def_exp_code != "" && def_exp_code != null && def_exp_code !=undefined) { 1347 if (def_exp_code != "" && def_exp_code != null && def_exp_code !=undefined) {
1121 var wu_arr=this.data.wu_arr; 1348 var wu_arr=this.data.wu_arr;
@@ -1148,7 +1375,7 @@ Page({ @@ -1148,7 +1375,7 @@ Page({
1148 var price =0,th=this; 1375 var price =0,th=this;
1149 price +=parseFloat(o_shipping_price); 1376 price +=parseFloat(o_shipping_price);
1150 //如果是包邮 1377 //如果是包邮
1151 - if (freight_free > 0 && o_price > freight_free){ return 0;} 1378 + if (freight_free > 0 && o_price >= freight_free){ return 0;}
1152 if (user_addr==null) { return 0; } 1379 if (user_addr==null) { return 0; }
1153 //计算物流的config item; 1380 //计算物流的config item;
1154 var item=null; 1381 var item=null;
@@ -1161,7 +1388,7 @@ Page({ @@ -1161,7 +1388,7 @@ Page({
1161 var fw_price = 0, fp_price=0; 1388 var fw_price = 0, fp_price=0;
1162 item=item.config; 1389 item=item.config;
1163 //------按重量---------- 1390 //------按重量----------
1164 - if (goods_weight>=0) { 1391 + if (goods_weight>=0 && item['money']) {
1165 fw_price =parseFloat(item['money']); 1392 fw_price =parseFloat(item['money']);
1166 if (goods_weight > item['first_weight']){ 1393 if (goods_weight > item['first_weight']){
1167 var fw = goods_weight - item['first_weight']; 1394 var fw = goods_weight - item['first_weight'];
@@ -1170,7 +1397,7 @@ Page({ @@ -1170,7 +1397,7 @@ Page({
1170 } 1397 }
1171 } 1398 }
1172 //------按件数---------- 1399 //------按件数----------
1173 - if (goods_piece > 0) { 1400 + if (goods_piece > 0 && item['piecemoney']) {
1174 fp_price = parseFloat(item['piecemoney']); 1401 fp_price = parseFloat(item['piecemoney']);
1175 if (goods_piece > item['first_piece']) { 1402 if (goods_piece > item['first_piece']) {
1176 var fp = goods_piece - item['first_piece']; 1403 var fp = goods_piece - item['first_piece'];
@@ -1218,6 +1445,7 @@ Page({ @@ -1218,6 +1445,7 @@ Page({
1218 var pickid=e.currentTarget.dataset.pickid; 1445 var pickid=e.currentTarget.dataset.pickid;
1219 var bn=e.currentTarget.dataset.bn; 1446 var bn=e.currentTarget.dataset.bn;
1220 var cindx=e.currentTarget.dataset.cind; 1447 var cindx=e.currentTarget.dataset.cind;
  1448 + var get_by_quan_list_cart=th.data.get_by_quan_list_cart[pickid];
1221 1449
1222 1450
1223 if(bn==1){ 1451 if(bn==1){
@@ -1225,13 +1453,25 @@ Page({ @@ -1225,13 +1453,25 @@ Page({
1225 }else{ 1453 }else{
1226 //---多单打开券的时候,就要判断券在其他门店是否有使用--- 1454 //---多单打开券的时候,就要判断券在其他门店是否有使用---
1227 var quanlist=th.data.cartlist[cindx].quan_list; 1455 var quanlist=th.data.cartlist[cindx].quan_list;
  1456 + var exp_type=th.data.cartlist[cindx].exp_type;
  1457 +
  1458 +
1228 //对于在其他门店已经选择了的券 要判断是否显示到界面 1459 //对于在其他门店已经选择了的券 要判断是否显示到界面
1229 for(var i in quanlist){ 1460 for(var i in quanlist){
1230 var is_using= th.check_in_sele(quanlist[i].CashRepNo,pickid); 1461 var is_using= th.check_in_sele(quanlist[i].CashRepNo,pickid);
1231 if(is_using) quanlist[i].is_using=1; 1462 if(is_using) quanlist[i].is_using=1;
1232 } 1463 }
  1464 +
  1465 + if(get_by_quan_list_cart){
  1466 + for(var i in get_by_quan_list_cart){
  1467 + var is_using= th.check_in_sele(get_by_quan_list_cart[i].no,pickid);
  1468 + if(is_using) quanlist[i].is_using=1;
  1469 + }
  1470 + th.setData({by_quan_list_cart:get_by_quan_list_cart});
  1471 + }
  1472 +
1233 console.log("2222222券的列表", quanlist); 1473 console.log("2222222券的列表", quanlist);
1234 - th.setData({open_quan:1,selected_quan_pick:pickid,selected_quan_list:quanlist,disabled:1}); 1474 + th.setData({ sele_cart_ind:cindx,sele_exp_type:exp_type,open_quan:1,selected_quan_pick:pickid,selected_quan_list:quanlist,disabled:1});
1235 } 1475 }
1236 }, 1476 },
1237 close_coupon:function (e) { 1477 close_coupon:function (e) {
@@ -1262,18 +1502,36 @@ Page({ @@ -1262,18 +1502,36 @@ Page({
1262 quanlist[ind].show_red=0; 1502 quanlist[ind].show_red=0;
1263 } 1503 }
1264 this.setData({selected_quan_list:quanlist}); 1504 this.setData({selected_quan_list:quanlist});
  1505 + var by_quanlist=this.data.get_by_quan_list;
  1506 + if(by_quanlist){
  1507 + //---所有的券的显示红色选择都清理一遍---
  1508 + for(var ind in by_quanlist){
  1509 + by_quanlist[ind].show_red=0;
  1510 + }
  1511 + this.setData({get_by_quan_list:by_quanlist});
  1512 + }
  1513 +
  1514 + var by_cart_list=this.data.by_quan_list_cart;
  1515 + if(by_cart_list){
  1516 + //---所有的券的显示红色选择都清理一遍---
  1517 + for(var ind in by_cart_list){
  1518 + by_cart_list[ind].show_red=0;
  1519 + }
  1520 + this.setData({by_quan_list_cart:by_cart_list});
  1521 + }
  1522 +
1265 var using_quan=this.data.using_quan; 1523 var using_quan=this.data.using_quan;
1266 var th=this; 1524 var th=this;
1267 //---如果是不使用优惠券--- 1525 //---如果是不使用优惠券---
1268 if(no_use==1){ 1526 if(no_use==1){
1269 - console.log("有进来吗券", no_use); 1527 + console.log("有进来吗券", no_use);
1270 if(using_quan[th.data.selected_quan_pick]){ 1528 if(using_quan[th.data.selected_quan_pick]){
1271 using_quan[th.data.selected_quan_pick].is_nouse_red=1; 1529 using_quan[th.data.selected_quan_pick].is_nouse_red=1;
1272 } 1530 }
1273 else{ 1531 else{
1274 using_quan[th.data.selected_quan_pick] ={is_nouse_red:1}; 1532 using_quan[th.data.selected_quan_pick] ={is_nouse_red:1};
1275 } 1533 }
1276 - this.setData({ using_quan: using_quan, is_coupon:2222}); 1534 + this.setData({ using_quan: using_quan, is_coupon:2222});
1277 return; 1535 return;
1278 } 1536 }
1279 1537
@@ -1299,31 +1557,142 @@ Page({ @@ -1299,31 +1557,142 @@ Page({
1299 1557
1300 }, 1558 },
1301 1559
  1560 +
  1561 + /*----- 点击选择包邮券 -----*/
  1562 + sele_quan_item_by:function(e) {
  1563 + var no_use=e.currentTarget.dataset.no;
  1564 + //立即购买的包邮券
  1565 + var by_quanlist=this.data.get_by_quan_list;
  1566 + if(by_quanlist) {
  1567 + //---所有的券的显示红色选择都清理一遍---
  1568 + for (var ind in by_quanlist) {
  1569 + by_quanlist[ind].show_red = 0;
  1570 + }
  1571 + this.setData({get_by_quan_list: by_quanlist});
  1572 + }
  1573 +
  1574 + //--购物车过来的包邮券--
  1575 + var by_cart_list=this.data.by_quan_list_cart;
  1576 + if(by_cart_list){
  1577 + //---所有的券的显示红色选择都清理一遍---
  1578 + for(var ind in by_cart_list){
  1579 + by_cart_list[ind].show_red=0;
  1580 + }
  1581 + this.setData({by_quan_list_cart:by_cart_list});
  1582 + }
  1583 + //普通券
  1584 + var quanlist=this.data.selected_quan_list;
  1585 + if(quanlist){
  1586 + //---所有的券的显示红色选择都清理一遍---
  1587 + for(var ind in quanlist){
  1588 + quanlist[ind].show_red=0;
  1589 + }
  1590 + this.setData({selected_quan_list:quanlist});
  1591 + }
  1592 +
  1593 + var th=this;
  1594 + var using_quan=this.data.using_quan;
  1595 + //---如果是不使用优惠券---
  1596 + if(no_use==1){
  1597 + if(using_quan[th.data.selected_quan_pick]){
  1598 + using_quan[th.data.selected_quan_pick].is_nouse_red=1;
  1599 + }
  1600 + else{
  1601 + using_quan[th.data.selected_quan_pick] ={is_nouse_red:1};
  1602 + }
  1603 + this.setData({ using_quan: using_quan, is_coupon:2222});
  1604 + return;
  1605 + }
  1606 +
  1607 + var ind = e.currentTarget.dataset.ind;
  1608 + //--如果是立即购买的部分--
  1609 + var txt="";var txt1=""; var quan_item=null;
  1610 + if(th.data.is_b_now){
  1611 + quan_item = this.data.get_by_quan_list[ind];
  1612 + txt = "get_by_quan_list[" + ind + "].show_red";
  1613 + }else{
  1614 + txt = "by_quan_list_cart[" + ind + "].show_red";
  1615 + quan_item = th.data.by_quan_list_cart[ind]
  1616 +
  1617 + }
  1618 + var obj = {}; obj[txt] = 1;
  1619 + if (quan_item.show_red) {
  1620 + obj[txt] = 0;
  1621 + }
  1622 +
  1623 + //购物车购买过来的商品
  1624 + if(txt1){
  1625 + obj[txt1] = 1;
  1626 + if (quan_item.show_red) {
  1627 + obj[txt1] = 0;
  1628 + }
  1629 + }
  1630 +
  1631 + this.setData(obj);
  1632 + if(using_quan[th.data.selected_quan_pick]){
  1633 + using_quan[th.data.selected_quan_pick].is_nouse_red=0;
  1634 + }
  1635 + else{
  1636 + using_quan[th.data.selected_quan_pick] ={is_nouse_red:0};
  1637 + }
  1638 + this.setData({using_quan:using_quan});
  1639 + },
  1640 +
1302 //--确认使用券--- 1641 //--确认使用券---
1303 confirm_quan:function () { 1642 confirm_quan:function () {
1304 -  
1305 - var using_quan=this.data.using_quan,pickid=this.data.selected_quan_pick;  
1306 - var th=this,selected_quan_list=this.data.selected_quan_list; 1643 + var using_quan=this.data.using_quan
  1644 + var pickid=this.data.selected_quan_pick;
  1645 + var th=this;
  1646 + var selected_quan_list=this.data.selected_quan_list;
  1647 + var get_by_quan_list=this.data.get_by_quan_list;
  1648 + var by_quan_list_cart=this.data.by_quan_list_cart;
1307 //选择了的券 1649 //选择了的券
1308 var sele_quan=null; 1650 var sele_quan=null;
1309 - console.log(selected_quan_list, "确认使用券"); 1651 +
  1652 + //循环普通的券
1310 for(var i in selected_quan_list){ 1653 for(var i in selected_quan_list){
1311 -  
1312 var item=selected_quan_list[i]; 1654 var item=selected_quan_list[i];
1313 - console.log(item, "确认使用券",item.show_red);  
1314 if(item.show_red) { 1655 if(item.show_red) {
1315 - console.log(item.show_red, "确定的券7");  
1316 th.insert_into_using_quan(item,using_quan,pickid); 1656 th.insert_into_using_quan(item,using_quan,pickid);
1317 return; 1657 return;
1318 } 1658 }
1319 } 1659 }
  1660 + //循环包邮的券,立即购买的
  1661 + for(var i in get_by_quan_list){
  1662 + var item=get_by_quan_list[i];
  1663 + if(item.show_red) {
  1664 + if(th.data.is_no_by[pickid]==1){
  1665 + getApp().my_warnning("已全场不能包邮,不能选择包邮券",0,th);return false;
  1666 + }
  1667 + if(th.data.is_by[pickid]==1){
  1668 + getApp().my_warnning("已全场包邮,不能选择包邮券",0,th);return false;
  1669 + }
1320 1670
1321 - //选择了的券,看是不是点击了不使用券 1671 + th.insert_into_using_quan(item,using_quan,pickid,1);
  1672 + return;
  1673 + }
  1674 + }
  1675 +
  1676 + //循环包邮的券
  1677 + for(var i in by_quan_list_cart){
  1678 + var item=by_quan_list_cart[i];
  1679 + if(item.show_red) {
  1680 + if(th.data.is_no_by[pickid]==1){
  1681 + getApp().my_warnning("已全场不能包邮,不能选择包邮券",0,th);return false;
  1682 + }
  1683 + if(th.data.is_by[pickid]==1){
  1684 + getApp().my_warnning("已全场包邮,不能选择包邮券",0,th);return false;
  1685 + }
  1686 + th.insert_into_using_quan(item,using_quan,pickid,1);
  1687 + return;
  1688 + }
  1689 + }
  1690 +
  1691 + //选择了的券,看是不是点击了不使用券,点击了不使用优惠券
1322 if(using_quan[pickid]){ 1692 if(using_quan[pickid]){
1323 if(using_quan[pickid].is_nouse_red==1){ 1693 if(using_quan[pickid].is_nouse_red==1){
1324 using_quan[pickid] ={is_nouse_red:1}; 1694 using_quan[pickid] ={is_nouse_red:1};
1325 th.setData({using_quan:using_quan}); 1695 th.setData({using_quan:using_quan});
1326 -  
1327 if(th.data.is_b_now==1){ 1696 if(th.data.is_b_now==1){
1328 th.calculatePrice2(); 1697 th.calculatePrice2();
1329 }else{ 1698 }else{
@@ -1336,11 +1705,16 @@ Page({ @@ -1336,11 +1705,16 @@ Page({
1336 }, 1705 },
1337 1706
1338 //----把券插入之后的操作,同时还要重新计算价格---- 1707 //----把券插入之后的操作,同时还要重新计算价格----
1339 - insert_into_using_quan:function (item,using_quan,pickid) { 1708 + insert_into_using_quan:function (item,using_quan,pickid,isby) {
1340 var th=this; 1709 var th=this;
1341 - using_quan[pickid]={coupon_no:item.CashRepNo,money:item.Sum,is_nouse_red:0}; 1710 + if(isby==1){
  1711 + using_quan[pickid]={coupon_no:item.no,money:0,is_nouse_red:0,region_list:item.region_list,goods_list:item.goods_list};
  1712 + using_quan[pickid].isby=1;
  1713 + }else{
  1714 + using_quan[pickid]={coupon_no:item.CashRepNo,money:item.Sum,is_nouse_red:0};
  1715 + using_quan[pickid].isby=0;
  1716 + }
1342 this.setData({using_quan:using_quan}); 1717 this.setData({using_quan:using_quan});
1343 -  
1344 if(th.data.is_b_now==1){ 1718 if(th.data.is_b_now==1){
1345 th.calculatePrice2(); 1719 th.calculatePrice2();
1346 }else{ 1720 }else{
@@ -1355,9 +1729,8 @@ Page({ @@ -1355,9 +1729,8 @@ Page({
1355 ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif"; 1729 ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";
1356 this.setData(ob); 1730 this.setData(ob);
1357 }, 1731 },
1358 -  
1359 //--验证是否已经冻结-- 1732 //--验证是否已经冻结--
1360 - check_is_frozenQuan:function(quanlist,frozenQuan){ 1733 + check_is_frozenQuan:function(quanlist,frozenQuan,isby){
1361 console.log("券列表",quanlist); 1734 console.log("券列表",quanlist);
1362 if(!quanlist) return null; 1735 if(!quanlist) return null;
1363 if(!frozenQuan) return quanlist; 1736 if(!frozenQuan) return quanlist;
@@ -1366,6 +1739,7 @@ Page({ @@ -1366,6 +1739,7 @@ Page({
1366 var item=quanlist[i]; 1739 var item=quanlist[i];
1367 var is_find=0; 1740 var is_find=0;
1368 var Q_no=quanlist[i].CashRepNo; 1741 var Q_no=quanlist[i].CashRepNo;
  1742 + if(isby) Q_no=quanlist[i].no;
1369 for(var j=0;j<frozenQuan.length;j++){ 1743 for(var j=0;j<frozenQuan.length;j++){
1370 var q_no=frozenQuan[j].cashRepNo; 1744 var q_no=frozenQuan[j].cashRepNo;
1371 if(Q_no==q_no){ 1745 if(Q_no==q_no){
@@ -1428,13 +1802,22 @@ Page({ @@ -1428,13 +1802,22 @@ Page({
1428 this.setData(obj); 1802 this.setData(obj);
1429 this.setData({disabled:1}) 1803 this.setData({disabled:1})
1430 }, 1804 },
1431 - //选择券  
1432 - sele_coupon:function(e){  
1433 - var ind = e.currentTarget.dataset.ind;  
1434 - console.log("下标", ind);  
1435 - this.setData({ is_coupon: ind}); 1805 +
  1806 + clik_coupons2:function(e){
  1807 + var ind = e.currentTarget.dataset.idx;
  1808 + var is_open = this.data.get_by_quan_list[ind].is_open;
  1809 +
  1810 + if (is_open == 1) is_open = 0;
  1811 + else is_open = 1;
  1812 +
  1813 + var txt = "get_by_quan_list[" + ind + "].is_open"
  1814 + var obj = {}; obj[txt] = is_open;
  1815 +
  1816 + this.setData(obj);
  1817 + this.setData({disabled:1})
1436 }, 1818 },
1437 - 1819 +
  1820 +
1438 //设置默认物流 1821 //设置默认物流
1439 select_default_logistics: function () { 1822 select_default_logistics: function () {
1440 var th=this; 1823 var th=this;
@@ -1526,7 +1909,7 @@ Page({ @@ -1526,7 +1909,7 @@ Page({
1526 var frozenQuan=null; 1909 var frozenQuan=null;
1527 var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id; 1910 var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id;
1528 app.request.promiseGet(url0,{1:1}).then(res=>{ 1911 app.request.promiseGet(url0,{1:1}).then(res=>{
1529 - if(res.data.code==0){ frozenQuan=res.data.data; } 1912 + if(res.data.code==0){ frozenQuan=res.data.data; th.data.frozenQuan=frozenQuan; }
1530 //--调用接口,获取优惠券的列表,3秒钟内控制接口请求-- 1913 //--调用接口,获取优惠券的列表,3秒钟内控制接口请求--
1531 var url="/api/weshop/couponList/getUseCouponList"; 1914 var url="/api/weshop/couponList/getUseCouponList";
1532 app.request.time_limit_get(6,url,{ 1915 app.request.time_limit_get(6,url,{
@@ -1552,7 +1935,7 @@ Page({ @@ -1552,7 +1935,7 @@ Page({
1552 var url="/api/weshop/couponList/getUseCouponList"; 1935 var url="/api/weshop/couponList/getUseCouponList";
1553 app.request.promiseGet(url0, {1: 1}).then(res => { 1936 app.request.promiseGet(url0, {1: 1}).then(res => {
1554 if (res.data.code == 0) { 1937 if (res.data.code == 0) {
1555 - frozenQuan = res.data.data; 1938 + frozenQuan = res.data.data;th.data.frozenQuan=frozenQuan;
1556 } 1939 }
1557 app.request.time_limit_get(6, url, { 1940 app.request.time_limit_get(6, url, {
1558 data: { 1941 data: {
@@ -1571,10 +1954,43 @@ Page({ @@ -1571,10 +1954,43 @@ Page({
1571 } 1954 }
1572 } 1955 }
1573 } 1956 }
1574 -  
1575 }) 1957 })
1576 }) 1958 })
1577 1959
1578 } 1960 }
  1961 + },
  1962 + //检查区域是不是包邮
  1963 + check_area:function(arr){
  1964 + var user_addr=this.data.user_addr;
  1965 + for(var i in arr){
  1966 + var item=arr[i];
  1967 + if(user_addr.twon==item || user_addr.district==item
  1968 + || user_addr.city==item|| user_addr.province==item ){
  1969 + return 0;
  1970 + }
  1971 + }
  1972 + return 1;
  1973 + },
  1974 +
  1975 + //检查立即购买的商品是不是不包邮
  1976 + check_good:function(arr,goods_id){
  1977 + if(!goods_id) goods_id=this.data.bn_goods.goods_id;
  1978 + for(var i in arr){
  1979 + var item=arr[i];
  1980 + if(goods_id==item) return 0;
  1981 + }
  1982 + return 1;
  1983 + },
  1984 + check_by_area:function(region_list){
  1985 + var arr=region_list.split(",");
  1986 + var check=this.check_area(arr);
  1987 + return !check;
  1988 + },
  1989 + check_by_goods:function(goods_list,goods_id){
  1990 + var arr=goods_list.split(",");
  1991 + var check=this.check_good(arr,goods_id);
  1992 + return !check;
1579 } 1993 }
  1994 +
  1995 +
1580 }); 1996 });
pages/cart/cart2/cart2.wxml
@@ -78,6 +78,7 @@ @@ -78,6 +78,7 @@
78 <view class="xc-right-frame"> 78 <view class="xc-right-frame">
79 <text wx:if="{{using_quan[item.pickup_id].is_nouse}}">不使用</text> 79 <text wx:if="{{using_quan[item.pickup_id].is_nouse}}">不使用</text>
80 <text wx:if="{{using_quan[item.pickup_id].money}}">¥{{using_quan[item.pickup_id].money}}元优惠券</text> 80 <text wx:if="{{using_quan[item.pickup_id].money}}">¥{{using_quan[item.pickup_id].money}}元优惠券</text>
  81 + <text wx:if="{{using_quan[item.pickup_id].isby}}">包邮券</text>
81 <view class="xc-right"></view> 82 <view class="xc-right"></view>
82 </view> 83 </view>
83 </view> 84 </view>
@@ -91,7 +92,7 @@ @@ -91,7 +92,7 @@
91 </view> 92 </view>
92 <view class="use-item flex-space-between"> 93 <view class="use-item flex-space-between">
93 <view class="flex-vertical"> 94 <view class="flex-vertical">
94 - <view bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type'style="display:{{item.distr_t==2?'none':'flex;align-items: center'}};"> 95 + <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type'style="display:{{item.distr_t==2?'none':'flex;align-items: center'}};">
95 <!-- <icon bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==1?'red':'gray'}}" size="16" type="success"></icon> --> 96 <!-- <icon bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==1?'red':'gray'}}" size="16" type="success"></icon> -->
96 97
97 98
@@ -103,10 +104,10 @@ @@ -103,10 +104,10 @@
103 <block wx:else> 104 <block wx:else>
104 <view class="circle xc-hookts on"></view> 105 <view class="circle xc-hookts on"></view>
105 </block> 106 </block>
106 - <view bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">门店自提</view> 107 + <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">门店自提</view>
107 </view> 108 </view>
108 109
109 - <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' bindtap="setexptype_w" style="display:{{item.distr_t==1?'none':'flex;align-items: center'}};"> 110 + <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w" style="display:{{item.distr_t==1?'none':'flex;align-items: center'}};">
110 <!-- <icon bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==0?'red':'gray'}}" size="16" type="success"></icon> --> 111 <!-- <icon bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==0?'red':'gray'}}" size="16" type="success"></icon> -->
111 <block wx:if="{{item.exp_type==0}}"> 112 <block wx:if="{{item.exp_type==0}}">
112 <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> 113 <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> -->
@@ -116,7 +117,7 @@ @@ -116,7 +117,7 @@
116 <view class="circle xc-hookts on"></view> 117 <view class="circle xc-hookts on"></view>
117 </block> 118 </block>
118 119
119 - <view bindtap='setexptype_w' data-t='0' 120 + <view bindtap='setexptype_w' data-t='0' data-ind="{{pidx}}"
120 data-txt='cartlist[{{pidx}}].exp_type' 121 data-txt='cartlist[{{pidx}}].exp_type'
121 data-wl_txt='cartlist[{{pidx}}].wind' 122 data-wl_txt='cartlist[{{pidx}}].wind'
122 class="yu_er">快递邮寄</view> 123 class="yu_er">快递邮寄</view>
@@ -203,7 +204,10 @@ @@ -203,7 +204,10 @@
203 </view> 204 </view>
204 <view class="xc-right-frame"> 205 <view class="xc-right-frame">
205 <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text> 206 <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text>
206 - <text wx:if="{{using_quan[bn_pick].money}}">¥{{using_quan[bn_pick].money}}元优惠券</text> 207 + <block wx:else>
  208 + <text wx:if="{{using_quan[bn_pick].money}}">¥{{using_quan[bn_pick].money}}元优惠券</text>
  209 + <text wx:if="{{using_quan[bn_pick].isby}}">包邮券</text>
  210 + </block>
207 <view class="xc-right"></view> 211 <view class="xc-right"></view>
208 </view> 212 </view>
209 </view> 213 </view>
@@ -284,153 +288,143 @@ @@ -284,153 +288,143 @@
284 288
285 <!-- 使用券列表的弹窗 --> 289 <!-- 使用券列表的弹窗 -->
286 <view wx:if='{{open_quan==1}}' > 290 <view wx:if='{{open_quan==1}}' >
287 - <view class="cover-layer flex-center " bindtap='close_coupon'>  
288 - </view> 291 + <view class="cover-layer flex-center " bindtap='close_coupon'> </view>
289 <view class="cx-popup {{open_quan==true?'up' : 'down'}}" > 292 <view class="cx-popup {{open_quan==true?'up' : 'down'}}" >
  293 + <!-- 最上面 -->
290 <view class="top flex"> 294 <view class="top flex">
291 - <view class="xc-top-content t-c">  
292 - <view class="xc-title">  
293 - 优惠券使用  
294 - </view>  
295 - </view>  
296 - <view class="xc-close-frame" bindtap='close_coupon' >  
297 - <view class="xc-close">×</view>  
298 - </view> 295 + <view class="xc-top-content t-c"><view class="xc-title">优惠券使用</view></view>
  296 + <view class="xc-close-frame" bindtap='close_coupon' ><view class="xc-close">×</view></view>
299 </view> 297 </view>
300 - <!-- <view class=""> -->  
301 - <view class="may_use_coupon fs28 flex">  
302 - 可使用的优惠券  
303 - <view class=" is_use_coupon flex-vertical" bindtap="sele_quan_item" data-no="1">  
304 - 不使用优惠券  
305 -  
306 - <block wx:if="{{using_quan[selected_quan_pick].is_nouse_red}}">  
307 - <view class="circle white xc-hooka fs20 red-b sn"><text>Γ</text></view>  
308 - </block>  
309 - <block wx:else>  
310 - <view class="circle xc-hookst ons"></view>  
311 - </block>  
312 -  
313 - </view>  
314 - </view>  
315 - <!-- </view> -->  
316 - <view class="xc-frame flex-level">  
317 - <view class="list-frame">  
318 -  
319 - <view wx:for="{{selected_quan_list}}" bindtap="sele_quan_item" wx:if="{{!item.is_using}}" data-ind="{{q_index}}" wx:for-item="item"wx:for-index="q_index">  
320 - <view class="xc-coupon-frame flex-center" bindtap="sele_coupon" data-ind="{{q_index}}">  
321 - <view class="coupon-frame flex rel">  
322 - <!-- 锯齿 -->  
323 - <view class="circle-frame abs">  
324 - <view class='circle circle-sawtooth'></view>  
325 - <view class='circle circle-sawtooth'></view>  
326 - <view class='circle circle-sawtooth'></view>  
327 - <view class='circle circle-sawtooth'></view>  
328 - <view class='circle circle-sawtooth'></view>  
329 - <view class='circle circle-sawtooth'></view>  
330 - <view class='circle circle-sawtooth'></view>  
331 - <view class='circle circle-sawtooth'></view>  
332 - <view class='circle circle-sawtooth'></view>  
333 - <view class='circle circle-sawtooth'></view>  
334 - <view class='circle circle-sawtooth'></view>  
335 - <view class='circle circle-sawtooth'></view>  
336 - <view class='circle circle-sawtooth'></view>  
337 - <view class='circle circle-sawtooth'></view>  
338 - <view class='circle circle-sawtooth'></view>  
339 - <view class='circle circle-sawtooth'></view>  
340 - <view class='circle circle-sawtooth'></view>  
341 - <view class='circle circle-sawtooth'></view>  
342 - <view class='circle circle-sawtooth'></view>  
343 - <view class='circle circle-sawtooth'></view> 298 + <!-- 使用优惠券和不使用优惠券层-->
  299 + <view class="may_use_coupon fs28 flex"> 可使用的优惠券
  300 + <view class=" is_use_coupon flex-vertical" bindtap="sele_quan_item" data-no="1">不使用优惠券
  301 + <block wx:if="{{using_quan[selected_quan_pick].is_nouse_red}}"><view class="circle white xc-hooka fs20 red-b sn"><text>Γ</text></view> </block>
  302 + <block wx:else><view class="circle xc-hookst ons"></view></block>
344 </view> 303 </view>
  304 + </view>
  305 +
  306 + <!-- 中间券内容显示 -->
  307 + <view class="xc-frame flex-level">
  308 + <view class="list-frame">
  309 + <view wx:for="{{selected_quan_list}}" bindtap="sele_quan_item" wx:if="{{!item.is_using}}" data-ind="{{q_index}}" wx:for-item="item" wx:for-index="q_index">
  310 + <view class="xc-coupon-frame flex-center" data-ind="{{q_index}}">
  311 + <view class="coupon-frame flex rel">
  312 + <!-- 锯齿 -->
  313 + <include src="juchi_part.wxml" />
  314 + <!-- 左边 -->
  315 + <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center">
  316 + <view class="white xc-money-frames">
  317 + <view class="f_text"><text class="xc-rmb-symbol">¥</text><text class="xc-rmb-val">{{item.Sum}}</text></view>
  318 + <view class="coupon-explain t-c" wx:if="{{item.BuySum>0}}">满{{item.BuySum}}元可用</view>
  319 + <view class="coupon-explain t-c" wx:else>满0元可用</view>
  320 + </view>
  321 + </view>
  322 + <!-- 右边 -->
  323 + <view class="coupon-right flex-center rel">
  324 + <view class="coupon-annotation flex">
  325 + <view class="flex top-frame">
  326 + <view class="frame">
  327 + <view class="coupon-wode ib flex ellipsis-2 ">
  328 + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(item.UseObjectType)}}</text>
  329 + <block>{{item.Sum}}元优惠券</block>
  330 + </view>
  331 + <view class="coupon-time">{{filters.replace_time2(item.BeginDate)}}至{{item.ValidDate?filters.replace_time2(item.ValidDate):'不限'}}</view>
  332 + </view>
  333 + </view>
  334 + <block wx:if="{{item.show_red}}"><view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view></block>
  335 + <block wx:else><view class="circle xc-hooks on"></view></block>
  336 + </view>
  337 + <include src="remark_click_part.wxml" />
  338 + </view>
  339 + </view>
  340 + </view>
  341 + <!-- 打开是说明 -->
  342 + <include src="remark_part.wxml" />
  343 + </view>
  344 + <!-- 包邮券的显示,立即购买 -->
  345 + <block wx:if="{{ is_b_now && bn_exp_type==0}}">
  346 + <view wx:for="{{get_by_quan_list}}" bindtap="sele_quan_item_by" wx:if="{{!item.is_using}}" data-ind="{{byq_index}}" wx:for-item="item" wx:for-index="byq_index">
  347 + <view class="xc-coupon-frame flex-center" data-ind="{{byq_index}}">
  348 + <view class="coupon-frame flex rel">
  349 + <!-- 锯齿 -->
  350 + <include src="juchi_part.wxml" />
  351 + <!-- 左边 -->
  352 + <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center">
  353 + <view class="white xc-money-frames">
  354 + <view class="f_text"><text class="xc-rmb-val">包邮券</text></view>
  355 + <view class="coupon-explain t-c" wx:if="{{item.condition>0}}">满{{item.condition}}元可用</view>
  356 + <view class="coupon-explain t-c" wx:else>满0元可用</view>
  357 + </view>
  358 + </view>
  359 + <!-- 右边 -->
  360 + <view class="coupon-right flex-center rel">
  361 + <view class="coupon-annotation flex">
  362 + <view class="flex top-frame">
  363 + <view class="frame">
  364 + <view class="coupon-wode ib flex ellipsis-2 ">
  365 + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(0)}}</text>
  366 + <block>包邮券</block>
  367 + </view>
  368 + <view class="coupon-time">{{filters.format_time(item.use_start_time)}}至{{item.use_end_time?filters.format_time(item.use_end_time):'不限'}}</view>
  369 + </view>
  370 + </view>
  371 + <block wx:if="{{item.show_red}}"><view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view></block>
  372 + <block wx:else><view class="circle xc-hooks on"></view></block>
  373 + </view>
  374 + <include src="remark_click_part2.wxml" />
  375 + </view>
  376 + </view>
  377 + </view>
  378 + <!-- 打开是说明 -->
  379 + <include src="remark_part.wxml" />
  380 + </view>
  381 + </block>
345 382
346 - <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center">  
347 -  
348 -  
349 - <view class="white xc-money-frames">  
350 - <view class="f_text">  
351 - <text class="xc-rmb-symbol">¥</text>  
352 - <text class="xc-rmb-val">{{item.Sum}}</text>  
353 - </view>  
354 -  
355 -  
356 -  
357 - <view class="coupon-explain t-c" wx:if="{{item.BuySum>0}}">  
358 - 满{{item.BuySum}}元可用  
359 - </view>  
360 - <view class="coupon-explain t-c" wx:else>  
361 - 满0元可用  
362 - </view>  
363 -  
364 - </view>  
365 - </view>  
366 - <view class="coupon-right flex-center rel">  
367 - <view class="coupon-annotation flex">  
368 -  
369 - <view class="flex top-frame">  
370 -  
371 - <view class="frame">  
372 - <!-- <view class="flex"> -->  
373 - <view class="coupon-wode ib flex ellipsis-2 ">  
374 - <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(item.UseObjectType)}}  
375 - </text>  
376 - <block>{{item.Sum}}元优惠券</block>  
377 - </view>  
378 - <view class="coupon-time">  
379 - {{filters.replace_time2(item.BeginDate)}}至{{item.ValidDate?filters.replace_time2(item.ValidDate):'不限'}}</view>  
380 - </view>  
381 - </view>  
382 - <!-- <view wx:if="{{item.Obtain>0}}" class="code-img" bindtap="show_quan" data-ind="{{index}}" data-now="{{filter.format_time(now)}}">  
383 - <image class="coupon-code" src='{{iurl}}/miniapp/images/user_r_code.png'></image>  
384 - </view>  
385 - <view wx:else class="code-img">  
386 - <image class="coupon-code" src='{{iurl}}/miniapp/images/hui-ewm.png'></image>  
387 - </view> -->  
388 -  
389 - <block wx:if="{{item.show_red}}">  
390 - <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view>  
391 - </block>  
392 - <block wx:else>  
393 - <view class="circle xc-hooks on"></view> 383 + <!-- 包邮券的显示,购物车购买 -->
  384 + <block wx:if="{{!is_b_now && sele_exp_type==0}}">
  385 + <view wx:for="{{by_quan_list_cart}}" bindtap="sele_quan_item_by" wx:if="{{!item.is_using}}" data-ind="{{byq_index}}" wx:for-item="item" wx:for-index="byq_index">
  386 + <view class="xc-coupon-frame flex-center" data-ind="{{byq_index}}">
  387 + <view class="coupon-frame flex rel">
  388 + <!-- 锯齿 -->
  389 + <include src="juchi_part.wxml" />
  390 + <!-- 左边 -->
  391 + <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center">
  392 + <view class="white xc-money-frames">
  393 + <view class="f_text"><text class="xc-rmb-val">包邮券</text></view>
  394 + <view class="coupon-explain t-c" wx:if="{{item.condition>0}}">满{{item.condition}}元可用</view>
  395 + <view class="coupon-explain t-c" wx:else>满0元可用</view>
  396 + </view>
  397 + </view>
  398 + <!-- 右边 -->
  399 + <view class="coupon-right flex-center rel">
  400 + <view class="coupon-annotation flex">
  401 + <view class="flex top-frame">
  402 + <view class="frame">
  403 + <view class="coupon-wode ib flex ellipsis-2 ">
  404 + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(0)}}</text>
  405 + <block>包邮券</block>
  406 + </view>
  407 + <view class="coupon-time">{{filters.format_time(item.use_start_time)}}至{{item.use_end_time?filters.format_time(item.use_end_time):'不限'}}</view>
  408 + </view>
  409 + </view>
  410 + <block wx:if="{{item.show_red}}"><view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view></block>
  411 + <block wx:else><view class="circle xc-hooks on"></view></block>
  412 + </view>
  413 + <include src="remark_click_part2.wxml" />
  414 + </view>
  415 + </view>
  416 + </view>
  417 + <!-- 打开是说明 -->
  418 + <include src="remark_part.wxml" />
  419 + </view>
394 </block> 420 </block>
395 - </view>  
396 421
397 -  
398 -  
399 - <view class="abs flex-vertical-between bottmo-explain" catchtap='clik_coupons' data-idx="{{q_index}}">  
400 - <view></view>  
401 - <view class="font-word flex">优惠券使用说明  
402 - <view class="circle circle-size flex t-c">  
403 - <view class="xc-jiantou">く</view>  
404 - </view>  
405 - </view>  
406 - </view>  
407 - </view>  
408 - </view>  
409 - </view>  
410 422
411 - <view class="xc-buttom " wx:if="{{item.is_open==1}}">  
412 - <view style="padding:10rpx">  
413 - <text class="five-level-word explain-coupon" wx:if="{{item.Remark}}">{{util.format(item.Remark)}}</text>  
414 - <text class="five-level-word explain-coupon" wx:else>  
415 - <block wx:if="{{item.UseObjectName}}">仅{{item.UseObjectName}}使用</block>  
416 - <block wx:else>全场通用</block>  
417 - </text>  
418 - </view> 423 + </view>
  424 + </view>
  425 + <!-- 最底下确定层-->
  426 + <view class="determine-frame"><view class="xc-confirm flex-center" bindtap="confirm_quan"> 确定 </view></view>
419 </view> 427 </view>
420 -  
421 -</view>  
422 -  
423 -  
424 -  
425 -  
426 - </view>  
427 - </view>  
428 - <view class="determine-frame">  
429 - <view class="xc-confirm flex-center" bindtap="confirm_quan">  
430 - 确定  
431 - </view>  
432 - </view>  
433 - </view >  
434 </view> 428 </view>
435 429
436 <!----弹起选择物流名的列表----> 430 <!----弹起选择物流名的列表---->
pages/cart/cart2/juchi_part.wxml 0 → 100644
  1 +<!-- 锯齿 -->
  2 +<view class="circle-frame abs">
  3 + <view class='circle circle-sawtooth'></view>
  4 + <view class='circle circle-sawtooth'></view>
  5 + <view class='circle circle-sawtooth'></view>
  6 + <view class='circle circle-sawtooth'></view>
  7 + <view class='circle circle-sawtooth'></view>
  8 + <view class='circle circle-sawtooth'></view>
  9 + <view class='circle circle-sawtooth'></view>
  10 + <view class='circle circle-sawtooth'></view>
  11 + <view class='circle circle-sawtooth'></view>
  12 + <view class='circle circle-sawtooth'></view>
  13 + <view class='circle circle-sawtooth'></view>
  14 + <view class='circle circle-sawtooth'></view>
  15 + <view class='circle circle-sawtooth'></view>
  16 + <view class='circle circle-sawtooth'></view>
  17 + <view class='circle circle-sawtooth'></view>
  18 + <view class='circle circle-sawtooth'></view>
  19 + <view class='circle circle-sawtooth'></view>
  20 + <view class='circle circle-sawtooth'></view>
  21 + <view class='circle circle-sawtooth'></view>
  22 + <view class='circle circle-sawtooth'></view>
  23 +</view>
0 \ No newline at end of file 24 \ No newline at end of file
pages/cart/cart2/remark_click_part.wxml 0 → 100644
  1 +<!--点击券说明-->
  2 +<view class="abs flex-vertical-between bottmo-explain" catchtap='clik_coupons' data-idx="{{q_index}}">
  3 + <view></view><view class="font-word flex">优惠券使用说明<view class="circle circle-size flex t-c"> <view class="xc-jiantou">く</view> </view></view>
  4 +</view>
0 \ No newline at end of file 5 \ No newline at end of file
pages/cart/cart2/remark_click_part2.wxml 0 → 100644
  1 +<!--点击券说明-->
  2 +<view class="abs flex-vertical-between bottmo-explain" catchtap='clik_coupons2' data-idx="{{byq_index}}">
  3 + <view></view><view class="font-word flex">优惠券使用说明<view class="circle circle-size flex t-c"> <view class="xc-jiantou">く</view> </view></view>
  4 +</view>
0 \ No newline at end of file 5 \ No newline at end of file
pages/cart/cart2/remark_part.wxml 0 → 100644
  1 +<view class="xc-buttom " wx:if="{{item.is_open==1}}" >
  2 + <view style="padding:10rpx">
  3 + <text class="five-level-word explain-coupon" wx:if="{{item.Remark}}">{{util.format(item.Remark)}}</text>
  4 + <text class="five-level-word explain-coupon" wx:else>
  5 + <block wx:if="{{item.UseObjectName}}">仅{{item.UseObjectName}}使用</block>
  6 + <block wx:else>全场通用</block>
  7 + </text>
  8 + </view>
  9 +</view>
0 \ No newline at end of file 10 \ No newline at end of file
pages/goods/goodsInfo/goodsInfo.js
@@ -1471,7 +1471,12 @@ Page({ @@ -1471,7 +1471,12 @@ Page({
1471 gb++; 1471 gb++;
1472 } 1472 }
1473 item.gg = gg; 1473 item.gg = gg;
1474 - item.original_img=os.imghost+item.spec_img; 1474 +
  1475 + if(item.spec_img)
  1476 + item.original_img=os.imghost+item.spec_img;
  1477 + else
  1478 + item.original_img=os.imghost+item.original_img;
  1479 +
1475 1480
1476 if (item.goods_id == g_id) { 1481 if (item.goods_id == g_id) {
1477 gitem = item; 1482 gitem = item;
@@ -1835,7 +1840,7 @@ Page({ @@ -1835,7 +1840,7 @@ Page({
1835 } 1840 }
1836 //---通过接口获取门店的线下库存信息-- 1841 //---通过接口获取门店的线下库存信息--
1837 return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ 1842 return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
1838 - data:{storageNos:pkno_str,wareIds:encodeURIComponent(th.data.sele_g.erpwareid),storeId:os.stoid} 1843 + data:{storageNos:pkno_str,wareIds:encodeURIComponent(th.data.sele_g.erpwareid),storeId:os.stoid,pageSize:2000}
1839 }) 1844 })
1840 }).then(res=>{ 1845 }).then(res=>{
1841 if(res.data.code==0){ 1846 if(res.data.code==0){
pages/goods/goodsInfo/goodsInfo.wxss
@@ -324,7 +324,6 @@ image { @@ -324,7 +324,6 @@ image {
324 width: 100%; 324 width: 100%;
325 height: 100rpx; 325 height: 100rpx;
326 background-color: #fff; 326 background-color: #fff;
327 - text-align: center;  
328 z-index: 9; 327 z-index: 9;
329 border-top: 4rpx solid #eee; 328 border-top: 4rpx solid #eee;
330 329
@@ -377,6 +376,7 @@ image { @@ -377,6 +376,7 @@ image {
377 color: #fff; 376 color: #fff;
378 line-height: 70rpx; 377 line-height: 70rpx;
379 margin-top: 16rpx; 378 margin-top: 16rpx;
  379 + text-align: center;
380 380
381 381
382 } 382 }
pages/template/index.js
@@ -16,8 +16,11 @@ Page({ @@ -16,8 +16,11 @@ Page({
16 16
17 onLoad: function(e) { 17 onLoad: function(e) {
18 var th = this; 18 var th = this;
19 - this.data.temp_id=e.sence;  
20 - if(!this.data.temp_id) this.data.temp_id=743; 19 + this.data.temp_id=e.scene;
  20 + if(!this.data.temp_id)
  21 + this.data.temp_id=e.sence;
  22 + if(!this.data.temp_id) wx.showModal({ title:"未读取到模板ID" ,})
  23 +
21 }, 24 },
22 25
23 async onShow() { 26 async onShow() {
pages/user/index/index.js
@@ -265,6 +265,11 @@ Page({ @@ -265,6 +265,11 @@ Page({
265 getApp().getConfig2(function(e) { 265 getApp().getConfig2(function(e) {
266 var t_swi = e.switch_list; 266 var t_swi = e.switch_list;
267 if (t_swi) t_swi = JSON.parse(t_swi) 267 if (t_swi) t_swi = JSON.parse(t_swi)
  268 + if(t_swi){
  269 + th.setData({sys_switch:t_swi})
  270 + }
  271 +
  272 +
268 if (parseInt(t_swi.rank_switch) == 2) { 273 if (parseInt(t_swi.rank_switch) == 2) {
269 var userInfo = th.data.userInfo; 274 var userInfo = th.data.userInfo;
270 if (userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") { 275 if (userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") {
pages/user/index/index.wxml
@@ -196,11 +196,19 @@ @@ -196,11 +196,19 @@
196 <view class="fs26">我的权益</view> 196 <view class="fs26">我的权益</view>
197 </view> 197 </view>
198 198
199 - <view class="item t-c" bindtap="contactService"> 199 + <button class="item t-c" wx:if="{{sys_switch.weapp_customertype}}" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  200 + <image class="xc-center-img " src="{{iurl}}/miniapp/images/kefu.png"></image>
  201 + <view class="fs26">联系客服</view>
  202 + </button>
  203 +
  204 + <view class="item t-c" bindtap="contactService" wx:else>
200 <image class="xc-center-img " src="{{iurl}}/miniapp/images/kefu.png"></image> 205 <image class="xc-center-img " src="{{iurl}}/miniapp/images/kefu.png"></image>
201 <view class="fs26">联系客服</view> 206 <view class="fs26">联系客服</view>
202 </view> 207 </view>
203 208
  209 +
  210 +
  211 +
204 <view class="item t-c" data-url="/pages/user/cardinfo/cardinfo" bindtap="goto" wx:if="{{is_dengji==1}}"> 212 <view class="item t-c" data-url="/pages/user/cardinfo/cardinfo" bindtap="goto" wx:if="{{is_dengji==1}}">
205 <image class="xc-center-img " src="{{iurl}}/miniapp/images/plus/privilege_o.png"></image> 213 <image class="xc-center-img " src="{{iurl}}/miniapp/images/plus/privilege_o.png"></image>
206 <view class="fs26">plus会员</view> 214 <view class="fs26">plus会员</view>
pages/user/index/index.wxss
@@ -706,4 +706,6 @@ @@ -706,4 +706,6 @@
706 .banner-frame{ 706 .banner-frame{
707 width: 100%; 707 width: 100%;
708 background: #f2f2f2; 708 background: #f2f2f2;
709 -}  
710 \ No newline at end of file 709 \ No newline at end of file
  710 +}
  711 +
  712 +button::after{ border: 0}
711 \ No newline at end of file 713 \ No newline at end of file
pages/user/order_list/order_list.js
@@ -56,10 +56,10 @@ Page({ @@ -56,10 +56,10 @@ Page({
56 th.setData({conf: e }); 56 th.setData({conf: e });
57 //--- 看后台是不是有开通等级卡 --- 57 //--- 看后台是不是有开通等级卡 ---
58 if(e.switch_list){ 58 if(e.switch_list){
59 - var s_list=JSON.parse(e.switch_list);  
60 - //如果后台有开启等级价的功能  
61 - if(parseInt(s_list.rank_switch)==2){  
62 - var user=getApp().globalData.userInfo; 59 + var s_list=JSON.parse(e.switch_list);
  60 + var user=getApp().globalData.userInfo;
  61 + //如果后台有开启等级价的功能
  62 + if(parseInt(s_list.rank_switch)==2 && user['card_expiredate']){
63 var str = user['card_expiredate'].replace(/-/g, '/'); 63 var str = user['card_expiredate'].replace(/-/g, '/');
64 var end = new Date(str); 64 var end = new Date(str);
65 end = Date.parse(end) / 1000; 65 end = Date.parse(end) / 1000;
utils/util.js
@@ -343,11 +343,36 @@ function draw_circle(ctx,x,y,r,img,color,unit){ @@ -343,11 +343,36 @@ function draw_circle(ctx,x,y,r,img,color,unit){
343 ctx.restore(); 343 ctx.restore();
344 } 344 }
345 345
346 -  
347 function null_promise(){ 346 function null_promise(){
348 var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise; 347 var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise;
349 } 348 }
350 349
  350 +//---合并数组去掉重复项---
  351 +function mergeArray(arr1, arr2){
  352 + for (var i = 0 ; i < arr1.length ; i ++ ){
  353 + for(var j = 0 ; j < arr2.length ; j ++ ){
  354 + if (arr1[i] === arr2[j]){
  355 + arr1.splice(i,1); //利用splice函数删除元素,从第i个位置,截取长度为1的元素
  356 + }
  357 + }
  358 + }
  359 + //alert(arr1.length)
  360 + for(var i = 0; i <arr2.length; i++){
  361 + arr1.push(arr2[i]);
  362 + }
  363 + return arr1;
  364 +}
  365 +
  366 +//一个数组是否包含另一个数组
  367 +function isContained(aa, bb) {
  368 + if (!(aa instanceof Array) || !(bb instanceof Array) || ((aa.length < bb.length))) { return false; }
  369 + var aaStr = aa.toString();
  370 + for (var i = 0; i < bb.length; i++) { if (aaStr.indexOf(bb[i]) < 0) return false; }
  371 + return true;
  372 +}
  373 +
  374 +
  375 +
351 module.exports = { 376 module.exports = {
352 formatTime: function(e, r) { 377 formatTime: function(e, r) {
353 var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { 378 var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) {
@@ -449,5 +474,7 @@ module.exports = { @@ -449,5 +474,7 @@ module.exports = {
449 draw_randon_rect:draw_randon_rect ,//画图画圆角矩形 474 draw_randon_rect:draw_randon_rect ,//画图画圆角矩形
450 null_promise:null_promise,//返回空的promise 475 null_promise:null_promise,//返回空的promise
451 get_box_arr:get_box_arr,//返回圆的数组 476 get_box_arr:get_box_arr,//返回圆的数组
452 - draw_circle:draw_circle,//绘制圆 477 + draw_circle:draw_circle,//绘制圆,
  478 + mergeArray:mergeArray, //数组合并
  479 + isContained:isContained, //是否包含
453 }; 480 };