Commit 78d663c2dd5f79359010b9390e29d56ea27a049e

Authored by abson
1 parent 6708cc76

oa测试返回

components/diy_goodsGroup/diy_goodsGroup.wxss
@@ -816,7 +816,7 @@ swiper { @@ -816,7 +816,7 @@ swiper {
816 background-color: rgba(0, 0, 0, 0.5); 816 background-color: rgba(0, 0, 0, 0.5);
817 } 817 }
818 818
819 -.t_red{ color:red;} 819 +.t_red{ color:red !important;}
820 820
821 .sp .sp_top .s_img image.zs_t3_3l{ 821 .sp .sp_top .s_img image.zs_t3_3l{
822 width: 56rpx; 822 width: 56rpx;
packageA/pages/quan_pro/quan_pro.wxml
@@ -26,7 +26,9 @@ @@ -26,7 +26,9 @@
26 <view class="fs28">满{{filters.toFix(q_data.condition,2)}}可用</view> 26 <view class="fs28">满{{filters.toFix(q_data.condition,2)}}可用</view>
27 </view> 27 </view>
28 </view> 28 </view>
29 - <text class="ellipsis-3 fs30">{{q_data.coupon_remark}}</text> 29 + <view class="coupon_remark">
  30 + <text class="ellipsis-2 fs26" style="height: 100%;">{{q_data.coupon_remark}}</text>
  31 + </view>
30 </view> 32 </view>
31 33
32 <block wx:if="{{ q_data}}"> 34 <block wx:if="{{ q_data}}">
packageA/pages/quan_pro/quan_pro.wxss
@@ -27,3 +27,5 @@ page{background-color: #f8f8f8;} @@ -27,3 +27,5 @@ page{background-color: #f8f8f8;}
27 } 27 }
28 28
29 .btn.gray{background-color: #dcdcdc; color: #adb3be;} 29 .btn.gray{background-color: #dcdcdc; color: #adb3be;}
  30 +.coupon_remark{padding: 20rpx 0; box-sizing: border-box; overflow: hidden;}
  31 +
packageB/pages/zuhegou/index/index.js
@@ -1966,6 +1966,7 @@ Page({ @@ -1966,6 +1966,7 @@ Page({
1966 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 1966 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
1967 if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) { 1967 if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) {
1968 var bz_num_ok=0; //超量倍增是否满足 1968 var bz_num_ok=0; //超量倍增是否满足
  1969 + var delete_num=0;
1969 var zhqty_len=0; //几个超量倍增 1970 var zhqty_len=0; //几个超量倍增
1970 var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); //看一下是几倍 1971 var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); //看一下是几倍
1971 if(this.data.act.is_bzyh && zhqty_bz.length > 0 ){ 1972 if(this.data.act.is_bzyh && zhqty_bz.length > 0 ){
@@ -1975,62 +1976,83 @@ Page({ @@ -1975,62 +1976,83 @@ Page({
1975 let new_arr=zhqty_bz.filter(ii=>{ 1976 let new_arr=zhqty_bz.filter(ii=>{
1976 return ii['num']==min_bz_num 1977 return ii['num']==min_bz_num
1977 }) 1978 })
1978 - // var vv=new_arr[0]; 1979 + var vv=new_arr[0];
  1980 + // be=new_arr[0].zhqty;
1979 var bz_num=be*new_arr[0].zhqty; //超量倍增 1981 var bz_num=be*new_arr[0].zhqty; //超量倍增
1980 var num=min_bz_num-new_arr[0].zhqty; //购买数量减去超量 1982 var num=min_bz_num-new_arr[0].zhqty; //购买数量减去超量
1981 - bz_num_ok=bz_num-num;  
1982 - if(bz_num_ok <= 0){  
1983 - //超量倍增满足,超量倍增就等于倍数  
1984 - bz_num_ok=bz_num;  
1985 - }else{  
1986 - //超量倍增不满足,倍数要减去多出得  
1987 - be=be-bz_num_ok;  
1988 - bz_num_ok=num;  
1989 - }  
1990 - for(let i=0;i<zhqty_bz.length;i++){  
1991 - var vv=zhqty_bz[i];  
1992 - for(let j=0;j<bz_num_ok;j++){  
1993 - let index= no_in_arr.findIndex(i=>{  
1994 - return vv.goods_id===i.goods_id  
1995 - })  
1996 - no_in_arr.splice(index,1)  
1997 - }  
1998 - }  
1999 - aprice += be * aprice;  
2000 - }else{  
2001 - var vv=zhqty_bz[0];  
2002 - var bz_num=be*vv.zhqty; //超量倍增  
2003 - var num=vv['num']-vv.zhqty; //购买数量减去超量 1983 + // if(num > 0){
2004 bz_num_ok=bz_num-num; 1984 bz_num_ok=bz_num-num;
2005 if(bz_num_ok <= 0){ 1985 if(bz_num_ok <= 0){
2006 //超量倍增满足,超量倍增就等于倍数 1986 //超量倍增满足,超量倍增就等于倍数
2007 bz_num_ok=bz_num; 1987 bz_num_ok=bz_num;
2008 }else{ 1988 }else{
2009 //超量倍增不满足,倍数要减去多出得 1989 //超量倍增不满足,倍数要减去多出得
2010 - be=be-bz_num_ok;  
2011 - bz_num_ok=num; 1990 + // be=be-bz_num_ok;
  1991 + if(num % vv.zhqty == 0){
  1992 + be=num/vv.zhqty;
  1993 + bz_num_ok=num;
  1994 + }else{
  1995 + be = Math.floor(num/vv.zhqty)
  1996 + bz_num_ok=num - (be * vv.zhqty);
  1997 + }
  1998 + }
  1999 + for(let i=0;i<zhqty_bz.length;i++){
  2000 + var vv=zhqty_bz[i];
  2001 + for(let j=0;j<bz_num_ok;j++){
  2002 + let index= no_in_arr.findIndex(i=>{
  2003 + return vv.goods_id===i.goods_id
  2004 + })
  2005 + if(index > -1){
  2006 + delete_num++
  2007 + no_in_arr.splice(index,1)
  2008 + }
  2009 + }
  2010 + }
  2011 + // }
  2012 + aprice += be * aprice;
  2013 + }else{
  2014 + var vv=zhqty_bz[0];
  2015 + var bz_num=be*vv.zhqty; //超量倍增
  2016 + var num=vv['num']-vv.zhqty; //购买数量减去超量
  2017 + if(num > 0){
  2018 + bz_num_ok=bz_num-num;
  2019 + if(bz_num_ok <= 0){
  2020 + //超量倍增满足,超量倍增就等于倍数
  2021 + bz_num_ok=bz_num;
  2022 + }else{
  2023 + //超量倍增不满足,倍数要减去多出得
  2024 + // be=be-bz_num_ok;
  2025 + if(num % vv.zhqty == 0){
  2026 + be=num/vv.zhqty;
  2027 + bz_num_ok=num;
  2028 + }else{
  2029 + be = Math.floor(num/vv.zhqty)
  2030 + bz_num_ok=num - (be * vv.zhqty);
  2031 + }
  2032 + }
  2033 + // be=vv.num;
  2034 + for(let j=0;j<bz_num_ok;j++){
  2035 + let index= no_in_arr.findIndex(i=>{
  2036 + return vv.goods_id===i.goods_id
  2037 + })
  2038 + if(index > -1){
  2039 + delete_num++
  2040 + no_in_arr.splice(index,1)
  2041 + }
  2042 + }
  2043 + }else{
  2044 + zhqty_len=1;
2012 } 2045 }
2013 - for(let j=0;j<bz_num_ok;j++){  
2014 - let index= no_in_arr.findIndex(i=>{  
2015 - return vv.goods_id===i.goods_id  
2016 - })  
2017 - no_in_arr.splice(index,1)  
2018 - }  
2019 } 2046 }
2020 } 2047 }
2021 if(!zhqty_len){ 2048 if(!zhqty_len){
2022 //多个超量就不用pop了 2049 //多个超量就不用pop了
2023 aprice += be * aprice; 2050 aprice += be * aprice;
2024 - let pop_num=be * this.data.act.zhbuyqty - bz_num_ok; 2051 + let pop_num=be * this.data.act.zhbuyqty - delete_num;
2025 for (var m = 0; m < pop_num; m++) { 2052 for (var m = 0; m < pop_num; m++) {
2026 no_in_arr.pop(); 2053 no_in_arr.pop();
2027 } 2054 }
2028 } 2055 }
2029 - // var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty);  
2030 - // aprice += be * aprice;  
2031 - // for (var m = 0; m < be * this.data.act.zhbuyqty; m++) {  
2032 - // no_in_arr.pop();  
2033 - // }  
2034 } 2056 }
2035 2057
2036 //算一下剩余的钱 2058 //算一下剩余的钱
pages/activity/seckill_list/seckill_list.js
1 -var e = getApp(), i = e.request, a = e.globalData.setting,os=a,ut = require("../../../utils/util.js"); 1 +var e = getApp(),
  2 + i = e.request,
  3 + a = e.globalData.setting,
  4 + os = a,
  5 + ut = require("../../../utils/util.js");
2 var regeneratorRuntime = require('../../../utils/runtime.js'); 6 var regeneratorRuntime = require('../../../utils/runtime.js');
3 7
4 Page({ 8 Page({
5 - data: {  
6 - url: a.imghost,  
7 - killtime: null,  
8 - currentPage: 1,  
9 - goodlist: null,  
10 - type:1,  
11 - timer:null,  
12 - ismore:1, //是否可以加载更多  
13 - isshow:0,  
14 - ad_data:null,  
15 - max_sw_height:200,  
16 - },  
17 -  
18 - //------初始化加载----------  
19 - onLoad: function(t) {  
20 - wx.setNavigationBarTitle({ title: "商品秒杀",})  
21 - var first_leader = t.first_leader;  
22 - var type=t.type;  
23 - if(type!=undefined){  
24 - this.setData({type:type});  
25 - } 9 + data: {
  10 + url: a.imghost,
  11 + killtime: null,
  12 + currentPage: 1,
  13 + goodlist: null,
  14 + type: 1,
  15 + timer: null,
  16 + ismore: 1, //是否可以加载更多
  17 + isshow: 0,
  18 + ad_data: null,
  19 + max_sw_height: 200,
  20 + },
  21 +
  22 + //------初始化加载----------
  23 + onLoad: function (t) {
  24 + wx.setNavigationBarTitle({
  25 + title: "商品秒杀",
  26 + })
  27 + var first_leader = t.first_leader;
  28 + var type = t.type;
  29 + if (type != undefined) {
  30 + this.setData({
  31 + type: type
  32 + });
  33 + }
26 34
27 - var th=this; 35 + var th = this;
  36 + console.log("------------");
  37 + console.log(first_leader);
  38 + getApp().getConfig();
28 39
29 - console.log("------------");  
30 - console.log(first_leader);  
31 - getApp().getConfig(); 40 + if (first_leader) {
  41 + getApp().globalData.first_leader = first_leader;
  42 + //调用接口判断是不是会员
  43 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  44 + if (res.data.code == 0) {
  45 + getApp().globalData.guide_id = res.data.data.id;
  46 + }
  47 + })
  48 + }
32 49
33 - if (first_leader) {  
34 - getApp().globalData.first_leader = first_leader;  
35 - //调用接口判断是不是会员  
36 - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {  
37 - if (res.data.code == 0) {  
38 - getApp().globalData.guide_id = res.data.data.id;  
39 - }  
40 - }) 50 + getApp().request.promiseGet("/api/weshop/ad/page?pid=701&store_id=" + os.stoid, {
  51 + data: {
  52 + enabled: 1
  53 + }
  54 + }).then(res => {
  55 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) {
  56 + var a = res.data.data.pageData;
  57 + var narr = [];
  58 + for (var i in a) {
  59 + var tt = {
  60 + 'ad_code': os.imghost + a[i].ad_code,
  61 + 'media_link': '',
  62 + 'ad_weapplink': a[i].ad_weapplink
  63 + };
  64 + narr.push(tt);
41 } 65 }
42 -  
43 - getApp().request.promiseGet("/api/weshop/ad/page?pid=701&store_id=" + os.stoid, {  
44 - data: {  
45 - enabled: 1  
46 - }  
47 - }).then(res => {  
48 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){  
49 - var a = res.data.data.pageData;  
50 - var narr=[];  
51 - for(var i in a){  
52 - var tt = {  
53 - 'ad_code': os.imghost + a[i].ad_code,  
54 - 'media_link': '',  
55 - 'ad_weapplink':a[i].ad_weapplink  
56 - };  
57 - narr.push(tt);  
58 - }  
59 - th.setData({ad_data:narr});  
60 - }  
61 - })  
62 -  
63 - },  
64 -  
65 -  
66 - onShow: function(t) {  
67 - this.data.ismore=1;  
68 - this.data.is_timer=1;  
69 - this.data.currentPage=1;  
70 - var th=this;th.setData({goodlist:null,})  
71 - this.requestSalelist();  
72 - //设置全局定时器  
73 - th.data.timer=setInterval(function () {  
74 - th.countDown();  
75 - },1000);  
76 - },  
77 - onHide:function(){  
78 - //--清理定时器--  
79 - clearInterval(this.data.timer);  
80 - this.setData({isshow:0});  
81 - },  
82 - //---小于10的格式化函数----  
83 - timeFormat(param) {  
84 - return param < 10 ? '0' + param : param;  
85 - }, 66 + th.setData({
  67 + ad_data: narr
  68 + });
  69 + }
  70 + })
  71 + this.requestSalelist();
  72 + },
  73 +
  74 +
  75 + onShow: function (t) {
  76 + this.data.ismore = 1;
  77 + this.data.is_timer = 1;
  78 + this.data.currentPage = 1;
  79 + var th = this;
  80 + //设置全局定时器
  81 + th.data.timer = setInterval(function () {
  82 + th.countDown();
  83 + }, 1000);
  84 + },
  85 + onHide: function () {
  86 + //--清理定时器--
  87 + clearInterval(this.data.timer);
  88 + this.setData({
  89 + isshow: 0
  90 + });
  91 + },
  92 + //---小于10的格式化函数----
  93 + timeFormat(param) {
  94 + return param < 10 ? '0' + param : param;
  95 + },
86 96
87 //----倒计时函数----- 97 //----倒计时函数-----
88 - countDown() {  
89 - if(!this.data.is_timer) return false;  
90 - var th=this; 98 + countDown() {
  99 + if (!this.data.is_timer) return false;
  100 + var th = this;
91 // 获取当前时间,同时得到活动结束时间数组 101 // 获取当前时间,同时得到活动结束时间数组
92 - let newTime =ut.gettimestamp(); 102 + let newTime = ut.gettimestamp();
93 var endTimeList = this.data.goodlist; 103 var endTimeList = this.data.goodlist;
94 - if(endTimeList==null) return null 104 + if (endTimeList == null) return null
95 // 对结束时间进行处理渲染到页面 105 // 对结束时间进行处理渲染到页面
96 - for (var i = 0; i < endTimeList.length;i++){  
97 - var o = endTimeList[i];  
98 - var endTime = o.end_time;  
99 - if(th.data.type==0) endTime = o.start_time;  
100 - let obj = null;  
101 - // 如果活动未结束,对时间进行处理  
102 - if (endTime - newTime > 0){  
103 - let time = (endTime - newTime);  
104 - // 获取天、时、分、秒  
105 - let day = parseInt(time / (60 * 60 * 24));  
106 - let hou = parseInt(time % (60 * 60 * 24) / 3600);  
107 - let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);  
108 - let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);  
109 - obj = {  
110 - day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec), hide: 1  
111 - }  
112 - }else{  
113 - //活动已结束,全部设置为'00'  
114 - obj = { day: '00', hou: '00', min: '00', sec: '00' }  
115 - }  
116 - var txt ="goodlist["+i+"].djs";  
117 - th.setData({ [txt]: obj}); 106 + for (var i = 0; i < endTimeList.length; i++) {
  107 + var o = endTimeList[i];
  108 + var endTime = o.end_time;
  109 + if (th.data.type == 0) endTime = o.start_time;
  110 + let obj = null;
  111 + // 如果活动未结束,对时间进行处理
  112 + if (endTime - newTime > 0) {
  113 + let time = (endTime - newTime);
  114 + // 获取天、时、分、秒
  115 + let day = parseInt(time / (60 * 60 * 24));
  116 + let hou = parseInt(time % (60 * 60 * 24) / 3600);
  117 + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  118 + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  119 + obj = {
  120 + day: this.timeFormat(day),
  121 + hou: this.timeFormat(hou),
  122 + min: this.timeFormat(min),
  123 + sec: this.timeFormat(sec),
  124 + hide: 1
118 } 125 }
119 - },  
120 -  
121 - async requestSalelist() {  
122 - //--没有更多就不调用--  
123 - if(!this.data.ismore) return false;  
124 - var e = this,th=e, i = "/api/ms/flash_sale/spikepage?page=" + e.data.currentPage;  
125 - var plist=null,alllist=th.data.goodlist;  
126 - if(!alllist) alllist=[];  
127 - var user_id=getApp().globalData.user_id;  
128 - if(!user_id) user_id=user_id;  
129 - var req={store_id:os.stoid,timetype:th.data.type,is_end:0,is_show:1,user_id:user_id};  
130 -  
131 - await getApp().request.promiseGet(i,  
132 - {isShowLoading:1,data:req}  
133 - ).then(res=>{  
134 - if(ut.ajax_ok(res)) plist=res.data.data.pageData; 126 + } else {
  127 + //活动已结束,全部设置为'00'
  128 + obj = {
  129 + day: '00',
  130 + hou: '00',
  131 + min: '00',
  132 + sec: '00'
  133 + }
  134 + }
  135 + var txt = "goodlist[" + i + "].djs";
  136 + th.setData({
  137 + [txt]: obj
  138 + });
  139 + }
  140 + },
135 141
136 - }); 142 + async requestSalelist() {
  143 + //--没有更多就不调用--
  144 + if (!this.data.ismore) return false;
  145 + var e = this,
  146 + th = e,
  147 + i = "/api/ms/flash_sale/spikepage?page=" + e.data.currentPage;
  148 + var plist = [],
  149 + alllist = th.data.goodlist;
  150 + if (!alllist) alllist = [];
  151 + var user_id = getApp().globalData.user_id;
  152 + if (!user_id) user_id = user_id;
  153 + var req = {
  154 + store_id: os.stoid,
  155 + timetype: th.data.type,
  156 + is_end: 0,
  157 + is_show: 1,
  158 + user_id: user_id
  159 + };
137 160
138 - if(plist.length<=0){  
139 -  
140 - getApp().showWarning("没有更多数据");  
141 - th.data.ismore=0;  
142 - if(e.data.currentPage==1 && this.data.type==1){  
143 - setTimeout(function () {  
144 - th.data.ismore=1;  
145 - th.setData({type:0});  
146 - th.requestSalelist();  
147 - },1000);  
148 - }  
149 - return false;  
150 - } 161 + await getApp().request.promiseGet(i, {
  162 + isShowLoading: 1,
  163 + data: req
  164 + }).then(res => {
  165 + if (ut.ajax_ok(res)) plist = res.data.data.pageData;
151 166
152 - //--循环读取接口---  
153 - for(var i=0;i<plist.length;i++) {  
154 -  
155 - if( plist[i].user_price) plist[i].price= plist[i].user_price;  
156 - var prom_id = plist[i].id;  
157 - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +  
158 - os.stoid + "/1/" + prom_id, {}  
159 - ).then(res=>{  
160 - if(res.data.code==0){  
161 - plist[i].status=1;  
162 - if(res.data.data<=0) plist[i].status=3;  
163 - }  
164 - })  
165 - alllist.push(plist[i]);  
166 - }  
167 - e.data.currentPage++;  
168 - console.log("秒杀商品列表", alllist);  
169 - th.setData({goodlist:alllist,isshow:1});  
170 -  
171 - },  
172 - onPullDownRefresh: function() {  
173 - this.reloadGoodList();  
174 - },  
175 - reloadGoodList: function() {  
176 - this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist();  
177 - },  
178 -  
179 - onReachBottom: function() {  
180 - this.requestSalelist();  
181 - },  
182 -  
183 - //点击tab事件  
184 - tip:function(e){  
185 - var a=e.currentTarget.dataset.ty,th=this;th.data.ismore=1;  
186 - this.setData({type:a,goodlist:null});  
187 - this.reloadGoodList();  
188 - },  
189 -  
190 -  
191 - //---------分享配置--------  
192 - onShareAppMessage: function (e) {  
193 - var curPage=this;  
194 - var pagePath = curPage.route; //当前页面url  
195 - if (pagePath.indexOf('/') != 0) {  
196 - pagePath = '/' + pagePath;  
197 - }  
198 - if(getApp().globalData.user_id){ 167 + });
199 168
200 - if(pagePath.indexOf("?")>0){  
201 - pagePath+="&first_leader="+getApp().globalData.user_id;  
202 - }else{  
203 - pagePath+="?first_leader="+getApp().globalData.user_id;  
204 - }  
205 - } 169 + if (plist.length <= 0) {
206 170
207 - console.log("11"+pagePath);  
208 - return {  
209 - title: "限时秒杀",  
210 - path:pagePath, 171 + getApp().showWarning("没有更多数据");
  172 + th.data.ismore = 0;
  173 + if (e.data.currentPage == 1 && this.data.type == 1) {
  174 + setTimeout(function () {
  175 + th.data.ismore = 1;
  176 + th.setData({
  177 + type: 0
  178 + });
  179 + th.requestSalelist();
  180 + }, 1000);
  181 + }
  182 + return false;
  183 + }
  184 +
  185 + //--循环读取接口---
  186 + for (var i = 0; i < plist.length; i++) {
  187 +
  188 + if (plist[i].user_price) plist[i].price = plist[i].user_price;
  189 + var prom_id = plist[i].id;
  190 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  191 + os.stoid + "/1/" + prom_id, {}
  192 + ).then(res => {
  193 + if (res.data.code == 0) {
  194 + plist[i].status = 1;
  195 + if (res.data.data <= 0) plist[i].status = 3;
211 } 196 }
212 - },  
213 -  
214 - //图片失败,默认图片  
215 - bind_bnerr2: function (e) {  
216 - var _errImg = e.target.dataset.errorimg;  
217 - var val = e.target.dataset.val;  
218 - if(val!=undefined && val!=null && val!='null' ){  
219 - var _errObj = {};  
220 - _errObj[_errImg] = "/public/images/default_goods_image_240.gif";  
221 - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;  
222 - }  
223 - },  
224 -  
225 - onShareTimeline() {  
226 - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:'';  
227 - if(!store_name)  
228 - store_name=getApp().globalData.setting.appName;  
229 - return {  
230 - title: '秒杀活动-' + store_name,  
231 - }  
232 - },  
233 -  
234 - imageLoad:function(e){  
235 - var imgwidth = e.detail.width;  
236 - var imgheight = e.detail.height;  
237 - //宽高比  
238 - var ratio = imgwidth / imgheight;  
239 - //计算的高度值  
240 - var viewHeight = 750 / ratio;  
241 - var hei=this.data.max_sw_height;  
242 -  
243 - if (hei< viewHeight) {  
244 - this.setData({ max_sw_height: viewHeight });  
245 - }  
246 - },  
247 - go_url(e){  
248 - let url=e.currentTarget.dataset.url;  
249 - if(url){  
250 - getApp().goto(url); 197 + })
  198 + alllist.push(plist[i]);
  199 + }
  200 + e.data.currentPage++;
  201 + console.log("秒杀商品列表", alllist);
  202 + th.setData({
  203 + goodlist: alllist,
  204 + isshow: 1
  205 + });
  206 +
  207 +
  208 +
  209 + },
  210 + onPullDownRefresh: function () {
  211 + this.reloadGoodList();
  212 + },
  213 + reloadGoodList: function () {
  214 + this.data.goodlist = [], this.data.currentPage = 1, this.requestSalelist();
  215 + },
  216 +
  217 + onReachBottom: function () {
  218 + this.requestSalelist();
  219 + },
  220 +
  221 + //点击tab事件
  222 + tip: function (e) {
  223 + var a = e.currentTarget.dataset.ty,
  224 + th = this;
  225 + th.data.ismore = 1;
  226 + this.setData({
  227 + type: a,
  228 + goodlist: null
  229 + });
  230 + this.reloadGoodList();
  231 + },
  232 +
  233 +
  234 + //---------分享配置--------
  235 + onShareAppMessage: function (e) {
  236 + var curPage = this;
  237 + var pagePath = curPage.route; //当前页面url
  238 + if (pagePath.indexOf('/') != 0) {
  239 + pagePath = '/' + pagePath;
  240 + }
  241 + if (getApp().globalData.user_id) {
  242 +
  243 + if (pagePath.indexOf("?") > 0) {
  244 + pagePath += "&first_leader=" + getApp().globalData.user_id;
  245 + } else {
  246 + pagePath += "?first_leader=" + getApp().globalData.user_id;
251 } 247 }
252 - }, 248 + }
  249 +
  250 + console.log("11" + pagePath);
  251 + return {
  252 + title: "限时秒杀",
  253 + path: pagePath,
  254 + }
  255 + },
  256 +
  257 + //图片失败,默认图片
  258 + bind_bnerr2: function (e) {
  259 + var _errImg = e.target.dataset.errorimg;
  260 + var val = e.target.dataset.val;
  261 + if (val != undefined && val != null && val != 'null') {
  262 + var _errObj = {};
  263 + _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
  264 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  265 + }
  266 + },
  267 +
  268 + onShareTimeline() {
  269 + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
  270 + if (!store_name)
  271 + store_name = getApp().globalData.setting.appName;
  272 + return {
  273 + title: '秒杀活动-' + store_name,
  274 + }
  275 + },
  276 +
  277 + imageLoad: function (e) {
  278 + var imgwidth = e.detail.width;
  279 + var imgheight = e.detail.height;
  280 + //宽高比
  281 + var ratio = imgwidth / imgheight;
  282 + //计算的高度值
  283 + var viewHeight = 750 / ratio;
  284 + var hei = this.data.max_sw_height;
253 285
254 -}); 286 + if (hei < viewHeight) {
  287 + this.setData({
  288 + max_sw_height: viewHeight
  289 + });
  290 + }
  291 + },
  292 + go_url(e) {
  293 + let url = e.currentTarget.dataset.url;
  294 + if (url) {
  295 + getApp().goto(url);
  296 + }
  297 + },
  298 +});
255 \ No newline at end of file 299 \ No newline at end of file
pages/cart/cart/cart.wxml
@@ -39,9 +39,9 @@ @@ -39,9 +39,9 @@
39 <!-- 购物车商品框架 --> 39 <!-- 购物车商品框架 -->
40 <view class="login-in"> 40 <view class="login-in">
41 <!-- 编辑 --> 41 <!-- 编辑 -->
42 - <view class="padding flex-vertical-between fs30 Storenum store" style="{{total_fee > 0 && freight_free - total_fee > 0 ? 'justify-content:space-between':'justify-content: flex-end;'}}">  
43 - <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">  
44 - <text>再买{{freight_free - total_fee}}元可享全场包邮({{weight_free}}kg内)</text> 42 + <view class="padding flex-vertical-between fs30 Storenum store" style="justify-content:space-between">
  43 + <view wx:if="{{freight_free}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
  44 + <text>全场满{{freight_free}}元可享包邮({{weight_free}}kg内)</text>
45 </view> 45 </view>
46 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view> 46 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view>
47 <view wx:else bindtap="edit_cart" data-type="0">完成</view> 47 <view wx:else bindtap="edit_cart" data-type="0">完成</view>
pages/cart/cart/zh_calculate.js
@@ -232,62 +232,92 @@ module.exports = { @@ -232,62 +232,92 @@ module.exports = {
232 } 232 }
233 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 233 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
234 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) { 234 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
235 - var bz_num_ok=0; //超量倍增是否满  
236 - var zhqty_len=0; //几个超量倍增  
237 - var be = parseInt(no_in_arr.length / act.zhbuyqty);//看一下是几倍 235 + var bz_num_ok = 0; //超量倍增是否满
  236 + var delete_num = 0;
  237 + var zhqty_len = 0; //几个超量倍增
  238 + var be = parseInt(no_in_arr.length / act.zhbuyqty); //看一下是几倍
238 if (act.is_bzyh && zhqty_bz.length > 0) { 239 if (act.is_bzyh && zhqty_bz.length > 0) {
239 - if(zhqty_bz.length>1){  
240 - zhqty_len=1;  
241 - let min_bz_num= Math.min.apply(Math, zhqty_bz.map(function(o) {return o['num']}));  
242 - let new_arr=zhqty_bz.filter(ii=>{  
243 - return ii['num']==min_bz_num 240 + if (zhqty_bz.length > 1) {
  241 + zhqty_len = 1;
  242 + let min_bz_num = Math.min.apply(Math, zhqty_bz.map(function (o) {
  243 + return o['num']
  244 + }));
  245 + let new_arr = zhqty_bz.filter(ii => {
  246 + return ii['num'] == min_bz_num
244 }) 247 })
245 - // var vv=new_arr[0];  
246 - var bz_num=be*new_arr[0].zhqty; //超量倍增  
247 - var num=min_bz_num-new_arr[0].zhqty; //购买数量减去超量  
248 - bz_num_ok=bz_num-num;  
249 - if(bz_num_ok <= 0){  
250 - //超量倍增满足,超量倍增就等于倍数  
251 - bz_num_ok=bz_num;  
252 - }else{  
253 - //超量倍增不满足,倍数要减去多出得  
254 - be=be-bz_num_ok;  
255 - bz_num_ok=num; 248 + var vv = new_arr[0];
  249 + // be=new_arr[0].zhqty;
  250 + var bz_num = be * new_arr[0].zhqty; //超量倍增
  251 + var num = min_bz_num - new_arr[0].zhqty; //购买数量减去超量
  252 + // if(num > 0){
  253 + bz_num_ok = bz_num - num;
  254 + if (bz_num_ok <= 0) {
  255 + //超量倍增满足,超量倍增就等于倍数
  256 + bz_num_ok = bz_num;
  257 + } else {
  258 + //超量倍增不满足,倍数要减去多出得
  259 + // be=be-bz_num_ok;
  260 + if (num % vv.zhqty == 0) {
  261 + be = num / vv.zhqty;
  262 + bz_num_ok = num;
  263 + } else {
  264 + be = Math.floor(num / vv.zhqty)
  265 + bz_num_ok = num - (be * vv.zhqty);
  266 + }
256 } 267 }
257 - for(let i=0;i<zhqty_bz.length;i++){  
258 - var vv=zhqty_bz[i];  
259 - for(let j=0;j<bz_num_ok;j++){  
260 - let index= no_in_arr.findIndex(i=>{  
261 - return vv.goods_id===i.goods_id  
262 - })  
263 - no_in_arr.splice(index,1)  
264 - } 268 + for (let i = 0; i < zhqty_bz.length; i++) {
  269 + var vv = zhqty_bz[i];
  270 + for (let j = 0; j < bz_num_ok; j++) {
  271 + let index = no_in_arr.findIndex(i => {
  272 + return vv.goods_id === i.goods_id
  273 + })
  274 + if (index > -1) {
  275 + delete_num++
  276 + no_in_arr.splice(index, 1)
  277 + }
  278 + }
265 } 279 }
  280 + // }
266 aprice += be * aprice; 281 aprice += be * aprice;
267 - }else{  
268 - var vv=zhqty_bz[0];  
269 - var bz_num=be*vv.zhqty; //超量倍增  
270 - var num=vv['num']-vv.zhqty; //购买数量减去超量  
271 - bz_num_ok=bz_num-num;  
272 - if(bz_num_ok <= 0){  
273 - //超量倍增满足,超量倍增就等于倍数  
274 - bz_num_ok=bz_num;  
275 - }else{  
276 - //超量倍增不满足,倍数要减去多出得  
277 - be=be-bz_num_ok;  
278 - bz_num_ok=num; 282 + } else {
  283 + var vv = zhqty_bz[0];
  284 + var bz_num = be * vv.zhqty; //超量倍增
  285 + var num = vv['num'] - vv.zhqty; //购买数量减去超量
  286 + if (num > 0) {
  287 + bz_num_ok = bz_num - num;
  288 + if (bz_num_ok <= 0) {
  289 + //超量倍增满足,超量倍增就等于倍数
  290 + bz_num_ok = bz_num;
  291 + } else {
  292 + //超量倍增不满足,倍数要减去多出得
  293 + // be=be-bz_num_ok;
  294 + if (num % vv.zhqty == 0) {
  295 + be = num / vv.zhqty;
  296 + bz_num_ok = num;
  297 + } else {
  298 + be = Math.floor(num / vv.zhqty)
  299 + bz_num_ok = num - (be * vv.zhqty);
  300 + }
  301 + }
  302 + // be=vv.num;
  303 + for (let j = 0; j < bz_num_ok; j++) {
  304 + let index = no_in_arr.findIndex(i => {
  305 + return vv.goods_id === i.goods_id
  306 + })
  307 + if (index > -1) {
  308 + delete_num++
  309 + no_in_arr.splice(index, 1)
279 } 310 }
280 - for(let j=0;j<bz_num_ok;j++){  
281 - let index= no_in_arr.findIndex(i=>{  
282 - return vv.goods_id===i.goods_id  
283 - })  
284 - no_in_arr.splice(index,1)  
285 - }  
286 - } 311 + }
  312 + } else {
  313 + zhqty_len = 1;
  314 + }
  315 + }
287 } 316 }
  317 +
288 if (!zhqty_len) { 318 if (!zhqty_len) {
289 aprice += be * act.zhprice; 319 aprice += be * act.zhprice;
290 - let pop_num=be * act.zhbuyqty - bz_num_ok; 320 + let pop_num = be * act.zhbuyqty - delete_num;
291 for (var m = 0; m < pop_num; m++) { 321 for (var m = 0; m < pop_num; m++) {
292 no_in_arr.pop(); 322 no_in_arr.pop();
293 } 323 }
pages/cart/cart2/zh_calculate.js
@@ -18,7 +18,7 @@ module.exports = { @@ -18,7 +18,7 @@ module.exports = {
18 let act_item = zh_prom_goods[i]; 18 let act_item = zh_prom_goods[i];
19 let act_goos = act_item.gdlist; 19 let act_goos = act_item.gdlist;
20 let act = act_item.act; 20 let act = act_item.act;
21 - if(!act) continue; 21 + if (!act) continue;
22 22
23 let all_num = 0; //商品数量之和 23 let all_num = 0; //商品数量之和
24 let all_price0 = 0; //商品数量之和 24 let all_price0 = 0; //商品数量之和
@@ -42,7 +42,7 @@ module.exports = { @@ -42,7 +42,7 @@ module.exports = {
42 for (let j in act_goos) { 42 for (let j in act_goos) {
43 let item = act_goos[j]; 43 let item = act_goos[j];
44 let item_j = goods.find(function (ele) { 44 let item_j = goods.find(function (ele) {
45 - console.log('ele',ele); 45 + console.log('ele', ele);
46 return ele.goods_id == act_goos[j].goods_id; 46 return ele.goods_id == act_goos[j].goods_id;
47 }) 47 })
48 //-- 如果有找到的话 -- 48 //-- 如果有找到的话 --
@@ -132,6 +132,7 @@ module.exports = { @@ -132,6 +132,7 @@ module.exports = {
132 } 132 }
133 } 133 }
134 } 134 }
  135 +
135 function sortData(a, b) { 136 function sortData(a, b) {
136 return a.price - b.price 137 return a.price - b.price
137 } 138 }
@@ -144,67 +145,97 @@ module.exports = { @@ -144,67 +145,97 @@ module.exports = {
144 } 145 }
145 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 146 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
146 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) { 147 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
147 - var bz_num_ok=0; //超量倍增是否满足  
148 - var zhqty_len=0; //几个超量倍增  
149 - let be = parseInt(no_in_arr.length / act.zhbuyqty);//看一下是几倍  
150 - if (act.is_bzyh && zhqty_bz.length > 0) {  
151 - if(zhqty_bz.length>1){  
152 - zhqty_len=1;  
153 - let min_bz_num= Math.min.apply(Math, zhqty_bz.map(function(o) {return o['num']}));  
154 - let new_arr=zhqty_bz.filter(ii=>{  
155 - return ii['num']==min_bz_num 148 + var bz_num_ok = 0; //超量倍增是否满足
  149 + var zhqty_len = 0; //几个超量倍增
  150 + var delete_num=0;
  151 + let be = parseInt(no_in_arr.length / act.zhbuyqty); //看一下是几倍
  152 + if (act.is_bzyh && zhqty_bz.length > 0) {
  153 + if (zhqty_bz.length > 1) {
  154 + zhqty_len = 1;
  155 + let min_bz_num = Math.min.apply(Math, zhqty_bz.map(function (o) {
  156 + return o['num']
  157 + }));
  158 + let new_arr = zhqty_bz.filter(ii => {
  159 + return ii['num'] == min_bz_num
156 }) 160 })
157 - // var vv=new_arr[0];  
158 - var bz_num=be*new_arr[0].zhqty; //超量倍增  
159 - var num=min_bz_num-new_arr[0].zhqty; //购买数量减去超量  
160 - bz_num_ok=bz_num-num;  
161 - if(bz_num_ok <= 0){ 161 + var vv = new_arr[0];
  162 + // be=new_arr[0].zhqty;
  163 + var bz_num = be * new_arr[0].zhqty; //超量倍增
  164 + var num = min_bz_num - new_arr[0].zhqty; //购买数量减去超量
  165 + // if(num > 0){
  166 + bz_num_ok = bz_num - num;
  167 + if (bz_num_ok <= 0) {
162 //超量倍增满足,超量倍增就等于倍数 168 //超量倍增满足,超量倍增就等于倍数
163 - bz_num_ok=bz_num;  
164 - }else{ 169 + bz_num_ok = bz_num;
  170 + } else {
165 //超量倍增不满足,倍数要减去多出得 171 //超量倍增不满足,倍数要减去多出得
166 - be=be-bz_num_ok;  
167 - bz_num_ok=num; 172 + // be=be-bz_num_ok;
  173 + if (num % vv.zhqty == 0) {
  174 + be = num / vv.zhqty;
  175 + bz_num_ok = num;
  176 + } else {
  177 + be = Math.floor(num / vv.zhqty)
  178 + bz_num_ok = num - (be * vv.zhqty);
  179 + }
168 } 180 }
169 - for(let i=0;i<zhqty_bz.length;i++){  
170 - var vv=zhqty_bz[i];  
171 - for(let j=0;j<bz_num_ok;j++){  
172 - let index= no_in_arr.findIndex(i=>{  
173 - return vv.goods_id===i.goods_id  
174 - })  
175 - no_in_arr.splice(index,1)  
176 - } 181 + for (let i = 0; i < zhqty_bz.length; i++) {
  182 + var vv = zhqty_bz[i];
  183 + for (let j = 0; j < bz_num_ok; j++) {
  184 + let index = no_in_arr.findIndex(i => {
  185 + return vv.goods_id === i.goods_id
  186 + })
  187 + if(index > -1){
  188 + delete_num++
  189 + no_in_arr.splice(index, 1)
  190 + }
  191 +
  192 + }
177 } 193 }
  194 + // }
178 aprice += be * aprice; 195 aprice += be * aprice;
179 - }else{  
180 - var vv=zhqty_bz[0];  
181 - var bz_num=be*vv.zhqty; //超量倍增  
182 - var num=vv['num']-vv.zhqty; //购买数量减去超量  
183 - bz_num_ok=bz_num-num;  
184 - if(bz_num_ok <= 0){ 196 + } else {
  197 + var vv = zhqty_bz[0];
  198 + var bz_num = be * vv.zhqty; //超量倍增
  199 + var num = vv['num'] - vv.zhqty; //购买数量减去超量
  200 + if (num > 0) {
  201 + bz_num_ok = bz_num - num;
  202 + if (bz_num_ok <= 0) {
185 //超量倍增满足,超量倍增就等于倍数 203 //超量倍增满足,超量倍增就等于倍数
186 - bz_num_ok=bz_num;  
187 - }else{ 204 + bz_num_ok = bz_num;
  205 + } else {
188 //超量倍增不满足,倍数要减去多出得 206 //超量倍增不满足,倍数要减去多出得
189 - be=be-bz_num_ok;  
190 - bz_num_ok=num; 207 + // be=be-bz_num_ok;
  208 + if (num % vv.zhqty == 0) {
  209 + be = num / vv.zhqty;
  210 + bz_num_ok = num;
  211 + } else {
  212 + be = Math.floor(num / vv.zhqty)
  213 + bz_num_ok = num - (be * vv.zhqty);
  214 + }
  215 + }
  216 + // be=vv.num;
  217 + for (let j = 0; j < bz_num_ok; j++) {
  218 + let index = no_in_arr.findIndex(i => {
  219 + return vv.goods_id === i.goods_id
  220 + })
  221 + if(index > -1){
  222 + delete_num++
  223 + no_in_arr.splice(index, 1)
  224 + }
191 } 225 }
192 - for(let j=0;j<bz_num_ok;j++){  
193 - let index= no_in_arr.findIndex(i=>{  
194 - return vv.goods_id===i.goods_id  
195 - })  
196 - no_in_arr.splice(index,1)  
197 - }  
198 - }  
199 - }  
200 - if (!zhqty_len) { 226 + } else {
  227 + zhqty_len = 1;
  228 + }
  229 + }
  230 + }
  231 + if (!zhqty_len) {
201 aprice += be * act.zhprice; 232 aprice += be * act.zhprice;
202 - let pop_num=be * act.zhbuyqty - bz_num_ok;  
203 - for (var m = 0; m < pop_num; m++) {  
204 - no_in_arr.pop();  
205 - }  
206 - }  
207 - 233 + let pop_num = be * act.zhbuyqty - delete_num;
  234 + for (var m = 0; m < pop_num; m++) {
  235 + no_in_arr.pop();
  236 + }
  237 + }
  238 +
208 } 239 }
209 240
210 let goods_map = {}; 241 let goods_map = {};
pages/giftpack/birthdaygift/birthdaygift.wxss
@@ -275,7 +275,7 @@ @@ -275,7 +275,7 @@
275 } 275 }
276 .button { 276 .button {
277 margin: 0 30rpx; 277 margin: 0 30rpx;
278 - background:var(--bg-color); 278 + background:#61d3dd;
279 border-radius: 50rpx; 279 border-radius: 50rpx;
280 line-height: 80rpx; 280 line-height: 80rpx;
281 height: 80rpx; 281 height: 80rpx;
@@ -301,14 +301,14 @@ @@ -301,14 +301,14 @@
301 text-align: center; 301 text-align: center;
302 -webkit-box-pack: center; 302 -webkit-box-pack: center;
303 -webkit-justify-content: center; 303 -webkit-justify-content: center;
304 - justify-content: center; 304 + justify-content: center;
305 position: fixed; 305 position: fixed;
306 bottom: 0; 306 bottom: 0;
307 left: 0; 307 left: 0;
308 width: 100%; 308 width: 100%;
309 } 309 }
310 .foot_button_buy { 310 .foot_button_buy {
311 - background:var(--color); 311 + background:#61d3dd;
312 color: #FFFFFF; 312 color: #FFFFFF;
313 width: 400rpx; 313 width: 400rpx;
314 height: 70rpx; 314 height: 70rpx;
pages/goods/goodsInfo/goodsInfo.wxss
@@ -3930,3 +3930,7 @@ button.custom-service::after { @@ -3930,3 +3930,7 @@ button.custom-service::after {
3930 overflow: hidden; 3930 overflow: hidden;
3931 flex-shrink: 0; 3931 flex-shrink: 0;
3932 } 3932 }
  3933 +.avatar-container image {
  3934 + width: 100%;
  3935 + height: 100%;
  3936 +}