Commit 7b960f778ca345044e7cc1602d25edebfa92de14

Authored by yvan.ni
1 parent bf754c0a

组合购测试返回的bug优化15条

packageB/pages/zuhegou/index/index.js
@@ -1040,7 +1040,7 @@ Page({ @@ -1040,7 +1040,7 @@ Page({
1040 } 1040 }
1041 } else { 1041 } else {
1042 dd = { 1042 dd = {
1043 - store_id: o.stoid, 1043 + store_id: os.stoid,
1044 isstop: 0, 1044 isstop: 0,
1045 pageSize: 2000 1045 pageSize: 2000
1046 } 1046 }
@@ -1615,21 +1615,21 @@ Page({ @@ -1615,21 +1615,21 @@ Page({
1615 //当满足组合的要求:总数要满足,起购数要满足 1615 //当满足组合的要求:总数要满足,起购数要满足
1616 if (all_num >= this.data.act.zhbuyqty && !need_to_buy) { 1616 if (all_num >= this.data.act.zhbuyqty && !need_to_buy) {
1617 function sortData(a, b) { 1617 function sortData(a, b) {
1618 - return b.price - a.price 1618 + return a.price - b.price
1619 } 1619 }
  1620 + if(no_in_arr.length) no_in_arr.sort(sortData);
1620 1621
1621 - no_in_arr.sort(sortData);  
1622 var aprice = this.data.act.zhprice; 1622 var aprice = this.data.act.zhprice;
1623 if (this.data.act.zhbuyqty > all_zhqty) { 1623 if (this.data.act.zhbuyqty > all_zhqty) {
1624 - for (var n = 0; n < this.data.act.zhbuyqty; n++) { 1624 + for (var n = 0; n < this.data.act.zhbuyqty-all_zhqty; n++) {
1625 no_in_arr.pop(); 1625 no_in_arr.pop();
1626 } 1626 }
1627 } 1627 }
1628 1628
1629 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 1629 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
1630 - if (this.data.act.is_bz && no_in_arr.length > this.data.act.zhbuyqty) { 1630 + if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) {
1631 //看一下是几倍 1631 //看一下是几倍
1632 - var be = parseInt(no_in_arr / this.data.act.zhbuyqty); 1632 + var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty);
1633 aprice += be * aprice; 1633 aprice += be * aprice;
1634 for (var m = 0; m < be * this.data.act.zhbuyqty; m++) { 1634 for (var m = 0; m < be * this.data.act.zhbuyqty; m++) {
1635 no_in_arr.pop(); 1635 no_in_arr.pop();
packageB/pages/zuhegou/index/index.wxss
@@ -117,7 +117,7 @@ page { @@ -117,7 +117,7 @@ page {
117 .share-container { 117 .share-container {
118 position: fixed; 118 position: fixed;
119 right: 20rpx; 119 right: 20rpx;
120 - bottom: 200rpx; 120 + bottom: 125rpx;
121 width: 100rpx; 121 width: 100rpx;
122 height: 100rpx; 122 height: 100rpx;
123 border-radius: 50%; 123 border-radius: 50%;
pages/cart/cart/cart.js
@@ -304,7 +304,7 @@ Page({ @@ -304,7 +304,7 @@ Page({
304 await getApp().request.promiseGet(url, {}).then(res => { 304 await getApp().request.promiseGet(url, {}).then(res => {
305 if(res.data.code==0 && res.data.data){ 305 if(res.data.code==0 && res.data.data){
306 if(res.data.data.is_show!=1){ 306 if(res.data.data.is_show!=1){
307 - return false; 307 + isok=0;
308 } 308 }
309 //如果活动已经结束 309 //如果活动已经结束
310 if(res.data.data.is_end==1){ 310 if(res.data.data.is_end==1){
@@ -1523,7 +1523,7 @@ Page({ @@ -1523,7 +1523,7 @@ Page({
1523 1523
1524 //--------------去结算------------ 1524 //--------------去结算------------
1525 async checkout() { 1525 async checkout() {
1526 - 1526 + if(!this.data.total_num || this.data.total_num<=0) return false;
1527 if(!this.data.is_load) return false; 1527 if(!this.data.is_load) return false;
1528 if(this.data.up_dating) { 1528 if(this.data.up_dating) {
1529 wx.showLoading({ 1529 wx.showLoading({
@@ -1587,7 +1587,8 @@ Page({ @@ -1587,7 +1587,8 @@ Page({
1587 glist += i_arr[j].goods_id + ","; 1587 glist += i_arr[j].goods_id + ",";
1588 ab = 1; 1588 ab = 1;
1589 //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- 1589 //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存---
1590 - if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || i_arr[j].need_downlow_num ) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1) { 1590 + if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5
  1591 + || i_arr[j].need_downlow_num ) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1) {
1591 //--获取商品的线下商品ID-- 1592 //--获取商品的线下商品ID--
1592 var gd = null; 1593 var gd = null;
1593 await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { 1594 await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => {
@@ -1749,7 +1750,8 @@ Page({ @@ -1749,7 +1750,8 @@ Page({
1749 if (g_arr[i].goods_id == val.goods_id) { 1750 if (g_arr[i].goods_id == val.goods_id) {
1750 1751
1751 //如果会员是等级会员,商品有等级价,且不是活动商品 1752 //如果会员是等级会员,商品有等级价,且不是活动商品
1752 - if (card_field && val[card_field] > 0 && (val.prom_type == 0 || val.prom_type == 3 || val.prom_type == 4 || val.prom_type == 5 || normal_arr[val.goods_id])) { 1753 + if (card_field && val[card_field] > 0 &&
  1754 + (val.prom_type == 0 || val.prom_type == 3 || val.prom_type == 4 || val.prom_type == 5 || val.prom_type == 7 || normal_arr[val.goods_id])) {
1753 if (g_arr[i].goods_price != val[card_field]) { 1755 if (g_arr[i].goods_price != val[card_field]) {
1754 isok = 0; 1756 isok = 0;
1755 gname = val.goods_name; 1757 gname = val.goods_name;
pages/cart/cart/zh_calculate.js
@@ -146,26 +146,28 @@ module.exports = { @@ -146,26 +146,28 @@ module.exports = {
146 146
147 //当满足组合的要求:总数要满足,起购数要满足 147 //当满足组合的要求:总数要满足,起购数要满足
148 if (all_num >= act.zhbuyqty && !need_to_buy) { 148 if (all_num >= act.zhbuyqty && !need_to_buy) {
149 - function sortData(a, b) {  
150 - return b.price - a.price  
151 - } 149 + function sortData(a, b) {
  150 + return a.price - b.price
  151 + }
  152 + if(no_in_arr.length>0) no_in_arr.sort(sortData);
152 153
153 - no_in_arr.sort(sortData);  
154 var aprice = act.zhprice; 154 var aprice = act.zhprice;
155 if (act.zhbuyqty > all_zhqty) { 155 if (act.zhbuyqty > all_zhqty) {
156 - for (var n = 0; n < act.zhbuyqty; n++) { 156 + for (var n = 0; n < act.zhbuyqty-all_zhqty; n++) {
157 no_in_arr.pop(); 157 no_in_arr.pop();
158 } 158 }
159 } 159 }
160 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 160 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
161 - if (act.is_bz && no_in_arr.length > act.zhbuyqty) { 161 + if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
162 //看一下是几倍 162 //看一下是几倍
163 - var be = parseInt(no_in_arr / act.zhbuyqty); 163 + var be = parseInt(no_in_arr.length / act.zhbuyqty);
164 aprice += be * act.zhprice; 164 aprice += be * act.zhprice;
165 for (var m = 0; m < be * act.zhbuyqty; m++) { 165 for (var m = 0; m < be * act.zhbuyqty; m++) {
166 no_in_arr.pop(); 166 no_in_arr.pop();
167 } 167 }
168 } 168 }
  169 +
  170 +
169 //算一下剩余的钱 171 //算一下剩余的钱
170 if (no_in_arr.length) { 172 if (no_in_arr.length) {
171 for (var ii in no_in_arr) { 173 for (var ii in no_in_arr) {
pages/cart/cart2/cart2.js
@@ -1469,7 +1469,7 @@ Page({ @@ -1469,7 +1469,7 @@ Page({
1469 var order_prom_id = 0; 1469 var order_prom_id = 0;
1470 var o_condition = cart_item.order_amount; 1470 var o_condition = cart_item.order_amount;
1471 //看一下是不是不用组合购的订单优惠的叠加 1471 //看一下是不是不用组合购的订单优惠的叠加
1472 - if(o_price_no_zh>0){ 1472 + if(is_has_zh){
1473 o_condition=o_price_no_zh-quan_price; 1473 o_condition=o_price_no_zh-quan_price;
1474 } 1474 }
1475 1475
pages/cart/cart2/cart2.wxml
@@ -429,7 +429,7 @@ @@ -429,7 +429,7 @@
429 </view> 429 </view>
430 <!-- 组合购优惠金额 --> 430 <!-- 组合购优惠金额 -->
431 <view class="item" wx:if="{{formData.zh_cut_price>0}}"> 431 <view class="item" wx:if="{{formData.zh_cut_price>0}}">
432 - <view>优惠活动</view> 432 + <view>组合购优惠</view>
433 <view class="co-red">- ¥ {{filters.toFix(formData.zh_cut_price,2)}}元</view> 433 <view class="co-red">- ¥ {{filters.toFix(formData.zh_cut_price,2)}}元</view>
434 </view> 434 </view>
435 435
pages/cart/cart2/zh_calculate.js
@@ -24,14 +24,14 @@ module.exports = { @@ -24,14 +24,14 @@ module.exports = {
24 let no_in_arr = []; //剩余的未加入组合购 24 let no_in_arr = []; //剩余的未加入组合购
25 25
26 for (let j in act_goos) { 26 for (let j in act_goos) {
  27 + let item = act_goos[j];
27 let item_j = goods.find(function (ele) { 28 let item_j = goods.find(function (ele) {
28 return ele.goods_id == act_goos[j].goods_id; 29 return ele.goods_id == act_goos[j].goods_id;
29 }) 30 })
30 - if(!item_j) continue;  
31 - act_goos[j].num = item_j.goods_num;  
32 - act_goos[j].goods_price = item_j.goods_price;  
33 - let item = act_goos[j];  
34 - if (item.num) { 31 + //-- 如果有找到的话 --
  32 + if (item_j) {
  33 + act_goos[j].num = item_j.goods_num;
  34 + act_goos[j].goods_price = item_j.goods_price;
35 all_num += item.num; 35 all_num += item.num;
36 //当有起购数的控制的时候 36 //当有起购数的控制的时候
37 if (item.zhqty) { 37 if (item.zhqty) {
@@ -65,19 +65,21 @@ module.exports = { @@ -65,19 +65,21 @@ module.exports = {
65 //当满足组合的要求:总数要满足,起购数要满足 65 //当满足组合的要求:总数要满足,起购数要满足
66 if (all_num >= act.zhbuyqty && !need_to_buy) { 66 if (all_num >= act.zhbuyqty && !need_to_buy) {
67 function sortData(a, b) { 67 function sortData(a, b) {
68 - return b.price - a.price 68 + return a.price - b.price
69 } 69 }
70 - no_in_arr.sort(sortData); 70 +
  71 + if(no_in_arr.length>0) no_in_arr.sort(sortData);
  72 +
71 aprice = act.zhprice; 73 aprice = act.zhprice;
72 if (act.zhbuyqty > all_zhqty) { 74 if (act.zhbuyqty > all_zhqty) {
73 - for (let n = 0; n < act.zhbuyqty; n++) { 75 + for (let n = 0; n < act.zhbuyqty-all_zhqty; n++) {
74 no_in_arr.pop(); 76 no_in_arr.pop();
75 } 77 }
76 } 78 }
77 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 79 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
78 - if (act.is_bz && no_in_arr.length > act.zhbuyqty) { 80 + if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
79 //看一下是几倍 81 //看一下是几倍
80 - let be = parseInt(no_in_arr / act.zhbuyqty); 82 + let be = parseInt(no_in_arr.length / act.zhbuyqty);
81 aprice += be * act.zhprice; 83 aprice += be * act.zhprice;
82 for (let m = 0; m < be * act.zhbuyqty; m++) { 84 for (let m = 0; m < be * act.zhbuyqty; m++) {
83 no_in_arr.pop(); 85 no_in_arr.pop();
pages/goods/goodsInfo/goodsInfo.js
@@ -1300,6 +1300,68 @@ Page({ @@ -1300,6 +1300,68 @@ Page({
1300 1300
1301 th.add_cart_next(e,t,a,o,newd); //加入购物车下一步 1301 th.add_cart_next(e,t,a,o,newd); //加入购物车下一步
1302 1302
  1303 + }else if(o.prom_type==7){
  1304 +
  1305 + //判断进行中的活动,是不是要判断线下库存
  1306 + check_zh_acting(function (e) {
  1307 + newd.prom_id = 0;
  1308 + newd.prom_type = 0;
  1309 + if(e){
  1310 + newd.prom_id = th.data.zh_act.id;
  1311 + newd.prom_type = 7;
  1312 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  1313 + if (o.store_count <e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  1314 + th.add_cart_next(e,t,a,o,newd); //加入购物车下一步
  1315 + return false;
  1316 + }else{
  1317 + //---如果是线下门店销售的时候---
  1318 + if(th.data.sales_rules==2){
  1319 + var pick=th.get_pick_from_list(th.data.sto_sele_id)
  1320 + //---通过接口获取门店的线下库存信息--
  1321 + getApp().request.get("/api/weshop/goods/getWareStorages",{
  1322 + data:{storageNos:pick.pickup_no,wareIds:encodeURIComponent(th.data.sele_g.erpwareid),storeId:os.stoid},
  1323 + success:function(res){
  1324 + if(res.data.code==0){
  1325 + if(res.data.data.pageData.length>0){
  1326 + var CanOutQty=res.data.data.pageData[0].CanOutQty;
  1327 + if(CanOutQty<e.data.goodsInputNum){
  1328 + return s.my_warnning("库存不足!", 0, th);
  1329 + }
  1330 + //在调一次接口,读取商品的预出库的数量,lock
  1331 + getApp().request.get("/api/weshop/order/ware/lock/page",{
  1332 + data:{store_id:os.stoid,wareId:th.data.sele_g.goods_id,storageId:pick.pickup_id,pageSize:1000},
  1333 + success:function(res_data){
  1334 + if(res_data.data.code==0 && res_data.data.data.total>0){
  1335 +
  1336 + var lock=0;
  1337 + for(var i in res_data.data.data.pageData){
  1338 + lock+=res_data.data.data.pageData[i].outQty;
  1339 + }
  1340 +
  1341 + if(CanOutQty<=lock){
  1342 + return s.my_warnning("库存不足!", 0, th);
  1343 + }
  1344 + th.add_cart_next(e,t,a,o,newd,CanOutQty-lock);
  1345 + }else{
  1346 + th.add_cart_next(e,t,a,o,newd,CanOutQty);
  1347 + }
  1348 + }
  1349 + })
  1350 + }else{
  1351 + return s.my_warnning("库存不足!", 0, th);
  1352 + }
  1353 +
  1354 + }
  1355 + }
  1356 + })
  1357 + }else{
  1358 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  1359 + if (o.store_count <e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  1360 + th.add_cart_next(e,t,a,o,newd); //加入购物车下一步
  1361 + }
  1362 + }
  1363 + })
  1364 +
1303 } 1365 }
1304 else if ( th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 2 || th.data.prom_type == 4 || th.data.prom_type == 5) { 1366 else if ( th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 2 || th.data.prom_type == 4 || th.data.prom_type == 5) {
1305 newd.prom_type = 0; 1367 newd.prom_type = 0;
@@ -1770,12 +1832,6 @@ Page({ @@ -1770,12 +1832,6 @@ Page({
1770 1832
1771 var ind = t.currentTarget.dataset.ind; 1833 var ind = t.currentTarget.dataset.ind;
1772 1834
1773 - if(th.data.zh_act && ind==1){  
1774 - getApp().goto("/packageB/pages/zuhegou/index/index?id="+th.data.zh_act.id);  
1775 - return false;  
1776 - }  
1777 -  
1778 -  
1779 //回调。判断是不是优惠促销 1835 //回调。判断是不是优惠促销
1780 th.check_is_prom_goods(function (){ 1836 th.check_is_prom_goods(function (){
1781 th.setData({ 1837 th.setData({
@@ -5466,5 +5522,42 @@ Page({ @@ -5466,5 +5522,42 @@ Page({
5466 go_zh:function (e) { 5522 go_zh:function (e) {
5467 var id=e.currentTarget.dataset.id; 5523 var id=e.currentTarget.dataset.id;
5468 getApp().goto("/packageB/pages/zuhegou/index/index?id="+id); 5524 getApp().goto("/packageB/pages/zuhegou/index/index?id="+id);
5469 - } 5525 + },
  5526 +
  5527 + check_zh_acting:function (func) {
  5528 + var isok = 1,item=this.data.sele_g;
  5529 + //如果有组合购
  5530 + var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+item.prom_id+"/"+getApp().globalData.userInfo.user_id;
  5531 + getApp().request.promiseGet(url, {}).then(res => {
  5532 + if(res.data.code==0 && res.data.data){
  5533 + if(res.data.data.is_show!=1){
  5534 + isok=0;
  5535 + }
  5536 + //如果活动已经结束
  5537 + if(res.data.data.is_end==1){
  5538 + isok=0;
  5539 + }
  5540 + //已经结束
  5541 + if(ut.gettimestamp()>res.data.data.end_time){
  5542 + isok=0;
  5543 + }
  5544 + //还未开始
  5545 + if(ut.gettimestamp()<res.data.data.start_time){
  5546 + isok=0;
  5547 + }
  5548 +
  5549 + }else{
  5550 + //未找到商品的活动
  5551 + isok = 0;
  5552 + }
  5553 + item.act=res.data.data;
  5554 + })
  5555 + func(isok);
  5556 + }
  5557 +
  5558 +
  5559 +
  5560 +
  5561 +
  5562 +
5470 }); 5563 });
pages/goods/goodsInfo/goodsInfo.wxml
@@ -519,7 +519,7 @@ @@ -519,7 +519,7 @@
519 <view class="flex"> 519 <view class="flex">
520 <image class="hui_img" src="{{iurl}}/miniapp//images/hui.png"></image> 520 <image class="hui_img" src="{{iurl}}/miniapp//images/hui.png"></image>
521 <view class="order_hui"> 521 <view class="order_hui">
522 - <view class="fs28 ellipsis-1">{{order_prom.name}}</view> 522 + <view class="fs28 ellipsis-1">{{zh_act.name}}</view>
523 <view class="fs26" >(活动时间:{{tool.format_tt(zh_act.start_time)}} - {{tool.format_tt(zh_act.end_time)}})</view> 523 <view class="fs26" >(活动时间:{{tool.format_tt(zh_act.start_time)}} - {{tool.format_tt(zh_act.end_time)}})</view>
524 </view> 524 </view>
525 </view> 525 </view>
pages/user/index/index.wxml
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <view class="xc-user-left flex" wx:if="{{userInfo}}"> 9 <view class="xc-user-left flex" wx:if="{{userInfo}}">
10 <image class="xc-user-img circle" bindtap="go_info" src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}"></image> 10 <image class="xc-user-img circle" bindtap="go_info" src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}"></image>
11 <view class="xc-uesr-name"> 11 <view class="xc-uesr-name">
12 - {{userInfo.nickname}} 12 + <text class="ellipsis-1" style="max-width: 290rpx;display: inline-block">{{userInfo.nickname}}</text>
13 <view class="hvip" wx:if='{{GradeName && is_init}}'> 13 <view class="hvip" wx:if='{{GradeName && is_init}}'>
14 <image class="vip-mem" src="{{iurl}}/miniapp/images/vip_hg0.png"></image>{{GradeName}}</view> 14 <image class="vip-mem" src="{{iurl}}/miniapp/images/vip_hg0.png"></image>{{GradeName}}</view>
15 <view class="flex fs24 xc-grow-ups" style="margin-left:8rpx;margin-top:6rpx" wx:if="{{is_init && gradeId}}" bindtap='jump'> 15 <view class="flex fs24 xc-grow-ups" style="margin-left:8rpx;margin-top:6rpx" wx:if="{{is_init && gradeId}}" bindtap='jump'>
pages/user/index/index.wxss
@@ -692,7 +692,7 @@ @@ -692,7 +692,7 @@
692 background: #383838; 692 background: #383838;
693 padding: 0 15rpx; 693 padding: 0 15rpx;
694 border-radius: 20rpx; 694 border-radius: 20rpx;
695 - vertical-align: middle; 695 + vertical-align: top;
696 } 696 }
697 697
698 .vip-mem { 698 .vip-mem {
pages/user/order_detail/order_detail.js
@@ -835,15 +835,15 @@ Page({ @@ -835,15 +835,15 @@ Page({
835 //--如果是赠品,不加入购物车-- 835 //--如果是赠品,不加入购物车--
836 if(g_item['is_gift']) continue; 836 if(g_item['is_gift']) continue;
837 if(g_item['prom_type']==4 ){ 837 if(g_item['prom_type']==4 ){
838 - $err_text+= g_item['goods_name']+"积分购商品不加入购物车\n"; 838 + err_text+= g_item['goods_name']+"积分购商品不加入购物车\n";
839 continue; 839 continue;
840 } 840 }
841 if(g_item['prom_type']==5){ 841 if(g_item['prom_type']==5){
842 - $err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n"; 842 + err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n";
843 continue; 843 continue;
844 } 844 }
845 if(g_item['prom_type']==6 ){ 845 if(g_item['prom_type']==6 ){
846 - $err_text+= g_item['goods_name']+"拼团商品不加入购物车\n"; 846 + err_text+= g_item['goods_name']+"拼团商品不加入购物车\n";
847 continue; 847 continue;
848 } 848 }
849 849
@@ -919,6 +919,21 @@ Page({ @@ -919,6 +919,21 @@ Page({
919 break; 919 break;
920 case 6: 920 case 6:
921 b_item.is_pd_normal=1; break; 921 b_item.is_pd_normal=1; break;
  922 + case 7:
  923 + //如果有组合购
  924 + var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+good.prom_id+"/"+getApp().globalData.userInfo.user_id;
  925 + await getApp().request.promiseGet(url, {}).then(res => {
  926 + if(res.data.code==0 && res.data.data){
  927 + if(res.data.data.is_show==1 && res.data.data.is_end==0
  928 + && ut.gettimestamp()<res.data.data.end_time
  929 + && ut.gettimestamp()>res.data.data.start_time
  930 + ){
  931 + b_item.prom_type=7;
  932 + b_item.prom_id=res.data.data.id;
  933 + }
  934 + }
  935 + })
  936 + break;
922 } 937 }
923 938
924 //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 939 //如果有优惠促销的时候,要看下商品的优惠活动有没有过期
pages/user/order_list/order_list.js
@@ -934,59 +934,59 @@ Page({ @@ -934,59 +934,59 @@ Page({
934 var goods_list=item.order_goods; 934 var goods_list=item.order_goods;
935 //--- 返回的内容 --- 935 //--- 返回的内容 ---
936 var back_goods_arr=[]; 936 var back_goods_arr=[];
937 - var err_text=""; 937 + var err_text="";
938 for(var i in goods_list){ 938 for(var i in goods_list){
939 var g_item=goods_list[i]; 939 var g_item=goods_list[i];
940 //--如果是赠品,不加入购物车-- 940 //--如果是赠品,不加入购物车--
941 - if(g_item['is_gift']) continue; 941 + if(g_item['is_gift']) continue;
942 if(g_item['prom_type']==4 ){ 942 if(g_item['prom_type']==4 ){
943 - $err_text+= g_item['goods_name']+"积分购商品不加入购物车\n"; 943 + err_text+= g_item['goods_name']+"积分购商品不加入购物车\n";
944 continue; 944 continue;
945 } 945 }
946 if(g_item['prom_type']==5){ 946 if(g_item['prom_type']==5){
947 - $err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n"; 947 + err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n";
948 continue; 948 continue;
949 } 949 }
950 if(g_item['prom_type']==6 ){ 950 if(g_item['prom_type']==6 ){
951 - $err_text+= g_item['goods_name']+"拼团商品不加入购物车\n"; 951 + err_text+= g_item['goods_name']+"拼团商品不加入购物车\n";
952 continue; 952 continue;
953 - }  
954 -  
955 - //--获取商品--  
956 - var good=null; 953 + }
  954 +
  955 + //--获取商品--
  956 + var good=null;
957 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, { 957 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, {
958 -  
959 - }).then(res=>{ 958 +
  959 + }).then(res=>{
960 good=res.data.data; 960 good=res.data.data;
961 }) 961 })
962 - 962 +
963 if(!good){ 963 if(!good){
964 err_text+= g_item['goods_name']+"未找到商品\n"; 964 err_text+= g_item['goods_name']+"未找到商品\n";
965 continue; 965 continue;
966 - } 966 + }
967 if (good.is_on_sale != 1) { 967 if (good.is_on_sale != 1) {
968 err_text+= g_item['goods_name']+"已经下架\n"; 968 err_text+= g_item['goods_name']+"已经下架\n";
969 - continue; 969 + continue;
970 } 970 }
971 -  
972 - var timestamp = ut.gettimestamp(); 971 +
  972 + var timestamp = ut.gettimestamp();
973 if (good.on_time > timestamp) { 973 if (good.on_time > timestamp) {
974 err_text+= g_item['goods_name']+"还未上架\n"; 974 err_text+= g_item['goods_name']+"还未上架\n";
975 - continue;  
976 - } 975 + continue;
  976 + }
977 if (good.down_time > 0) { 977 if (good.down_time > 0) {
978 if (good.down_time < timestamp) { 978 if (good.down_time < timestamp) {
979 err_text+=g_item['goods_name']+"已经下架\n"; 979 err_text+=g_item['goods_name']+"已经下架\n";
980 continue; 980 continue;
981 } 981 }
982 } 982 }
983 - 983 +
984 //如果商品的配送方式和门店不匹配 984 //如果商品的配送方式和门店不匹配
985 if(good['distr_type']>0 && pickup['distr_type']>0 && good['distr_type']!=pickup['distr_type'] ){ 985 if(good['distr_type']>0 && pickup['distr_type']>0 && good['distr_type']!=pickup['distr_type'] ){
986 err_text+= good['goods_name']+"配送方式不一致\n"; 986 err_text+= good['goods_name']+"配送方式不一致\n";
987 continue; 987 continue;
988 } 988 }
989 - 989 +
990 var prom=null; 990 var prom=null;
991 var b_item={} 991 var b_item={}
992 b_item.goods_id=g_item.goods_id; 992 b_item.goods_id=g_item.goods_id;
@@ -997,38 +997,56 @@ Page({ @@ -997,38 +997,56 @@ Page({
997 b_item.pickup_id=item.pickup_id; 997 b_item.pickup_id=item.pickup_id;
998 b_item.price=good.shop_price; 998 b_item.price=good.shop_price;
999 b_item.goods_sn=good.goods_sn; 999 b_item.goods_sn=good.goods_sn;
1000 - b_item.sku=good.sku; 1000 + b_item.sku=good.sku;
1001 b_item.is_integral_normal=g_item.is_integral_normal; 1001 b_item.is_integral_normal=g_item.is_integral_normal;
1002 - 1002 +
1003 //-- 如果会员是等级卡的时候,同时商品也有设置相应的卡价格 -- 1003 //-- 如果会员是等级卡的时候,同时商品也有设置相应的卡价格 --
1004 var card_field=th.data.card_field; 1004 var card_field=th.data.card_field;
1005 if(card_field && good[card_field]>0){ 1005 if(card_field && good[card_field]>0){
1006 - b_item.price=good[card_field]; 1006 + b_item.price=good[card_field];
1007 } 1007 }
1008 - 1008 +
1009 //--判断商品当前的活动情况-- 1009 //--判断商品当前的活动情况--
1010 switch(good.prom_type){ 1010 switch(good.prom_type){
1011 //秒杀 1011 //秒杀
1012 - case 1: 1012 + case 1:
1013 var flash=null; 1013 var flash=null;
1014 - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + good.prom_id, { 1014 + await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + good.prom_id, {
1015 }).then(res=>{ 1015 }).then(res=>{
1016 if (res.data.code== 0) { 1016 if (res.data.code== 0) {
1017 flash=res.data.data; 1017 flash=res.data.data;
1018 } 1018 }
1019 - })  
1020 - //----已经结束----- 1019 + })
  1020 + //----活动还没有结束-----
1021 if (flash && flash.is_end == 0 && flash.end_time>timestamp && flash.start_time<timestamp ) { 1021 if (flash && flash.is_end == 0 && flash.end_time>timestamp && flash.start_time<timestamp ) {
1022 prom=flash; 1022 prom=flash;
1023 b_item.price=prom.price; // 1023 b_item.price=prom.price; //
1024 - }  
1025 - break;  
1026 -  
1027 - //拼团  
1028 - case 6:  
1029 - b_item.is_pd_normal=1; break; 1024 + }
  1025 + break;
  1026 +
  1027 + //拼团
  1028 + case 6:
  1029 + b_item.is_pd_normal=1;
  1030 + break;
  1031 + //组合购的再来一单
  1032 + case 7:
  1033 + //如果有组合购
  1034 + var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+good.prom_id+"/"+getApp().globalData.userInfo.user_id;
  1035 + await getApp().request.promiseGet(url, {}).then(res => {
  1036 + if(res.data.code==0 && res.data.data){
  1037 + if(res.data.data.is_show==1 && res.data.data.is_end==0
  1038 + && ut.gettimestamp()<res.data.data.end_time
  1039 + && ut.gettimestamp()>res.data.data.start_time
  1040 + ){
  1041 + b_item.prom_type=7;
  1042 + b_item.prom_id=res.data.data.id;
  1043 + }
  1044 + }
  1045 + })
  1046 + break;
1030 } 1047 }
1031 - 1048 +
  1049 +
1032 //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 1050 //如果有优惠促销的时候,要看下商品的优惠活动有没有过期
1033 if(g_item.prom_type==3 || good.prom_type==3){ 1051 if(g_item.prom_type==3 || good.prom_type==3){
1034 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => { 1052 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => {
@@ -1038,15 +1056,15 @@ Page({ @@ -1038,15 +1056,15 @@ Page({
1038 b_item.prom_type=3; 1056 b_item.prom_type=3;
1039 b_item.prom_id=r_data.promGoodsLists[0].prom_id; 1057 b_item.prom_id=r_data.promGoodsLists[0].prom_id;
1040 } 1058 }
1041 - }  
1042 - }) 1059 + }
  1060 + })
1043 } 1061 }
1044 -  
1045 - //判断是不是线下库存的购买, 是不是秒杀活动  
1046 - if(th.data.sales_rules==2 && !prom){ 1062 +
  1063 + //判断是不是线下库存的购买, 是不是秒杀活动
  1064 + if(th.data.sales_rules==2 && !prom){
1047 //-- 看一下购物车上有多少商品 -- 1065 //-- 看一下购物车上有多少商品 --
1048 - var cart_num=0;  
1049 - await getApp().request.promiseGet("/api/weshop/cart/page", { 1066 + var cart_num=0;
  1067 + await getApp().request.promiseGet("/api/weshop/cart/page", {
1050 data: { 1068 data: {
1051 store_id: os.stoid, 1069 store_id: os.stoid,
1052 user_id: getApp().globalData.user_id, 1070 user_id: getApp().globalData.user_id,
@@ -1061,9 +1079,9 @@ Page({ @@ -1061,9 +1079,9 @@ Page({
1061 num += res.data.data.pageData[i].goods_num; 1079 num += res.data.data.pageData[i].goods_num;
1062 } 1080 }
1063 } 1081 }
1064 - cart_num=num; 1082 + cart_num=num;
1065 }) 1083 })
1066 - 1084 +
1067 var lock=0,plist=null; 1085 var lock=0,plist=null;
1068 //先读取门店的lock, 1086 //先读取门店的lock,
1069 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ 1087 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
@@ -1072,26 +1090,26 @@ Page({ @@ -1072,26 +1090,26 @@ Page({
1072 if(res.data.code==0 && res.data.data.total>0){ 1090 if(res.data.code==0 && res.data.data.total>0){
1073 for(var i in res.data.data.pageData) 1091 for(var i in res.data.data.pageData)
1074 lock+=res.data.data.pageData[i].outQty 1092 lock+=res.data.data.pageData[i].outQty
1075 - } 1093 + }
1076 }) 1094 })
1077 - 1095 +
1078 //---通过接口获取门店的线下库存信息-- 1096 //---通过接口获取门店的线下库存信息--
1079 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ 1097 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
1080 data:{storageNos:pickup.pickup_no,wareIds:encodeURIComponent(good.erpwareid),storeId:os.stoid} 1098 data:{storageNos:pickup.pickup_no,wareIds:encodeURIComponent(good.erpwareid),storeId:os.stoid}
1081 }).then(res=>{ 1099 }).then(res=>{
1082 if(res.data.code==0 && res.data.data.total>0){ 1100 if(res.data.code==0 && res.data.data.total>0){
1083 plist=res.data.data.pageData[0]; 1101 plist=res.data.data.pageData[0];
1084 - } 1102 + }
1085 }) 1103 })
1086 - 1104 +
1087 if(!plist){ 1105 if(!plist){
1088 err_text+= good['goods_name']+"库存不足\n"; 1106 err_text+= good['goods_name']+"库存不足\n";
1089 - continue;  
1090 - } 1107 + continue;
  1108 + }
1091 if(plist.CanOutQty-lock<=0){ 1109 if(plist.CanOutQty-lock<=0){
1092 err_text+= good['goods_name']+"库存不足\n"; 1110 err_text+= good['goods_name']+"库存不足\n";
1093 - continue;  
1094 - } 1111 + continue;
  1112 + }
1095 if(b_item.goods_num>(plist.CanOutQty-lock)){ 1113 if(b_item.goods_num>(plist.CanOutQty-lock)){
1096 b_item.goods_num=plist.CanOutQty-lock; 1114 b_item.goods_num=plist.CanOutQty-lock;
1097 } 1115 }
@@ -1100,42 +1118,42 @@ Page({ @@ -1100,42 +1118,42 @@ Page({
1100 user_id: getApp().globalData.user_id, 1118 user_id: getApp().globalData.user_id,
1101 goods_id: good.goods_id, 1119 goods_id: good.goods_id,
1102 }; 1120 };
1103 -  
1104 - var buynum=0; 1121 +
  1122 + var buynum=0;
1105 //---要获得商品,该用户买了多少件,同步应用--- 1123 //---要获得商品,该用户买了多少件,同步应用---
1106 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { 1124 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
1107 data: req_data, 1125 data: req_data,
1108 - }).then(res => { 1126 + }).then(res => {
1109 if(res.data.code==0){ 1127 if(res.data.code==0){
1110 var buy_num_data = res.data.data; 1128 var buy_num_data = res.data.data;
1111 buynum = buy_num_data.goodsbuynum; 1129 buynum = buy_num_data.goodsbuynum;
1112 - } 1130 + }
1113 }) 1131 })
1114 - 1132 +
1115 //---- 要计算商品的限购 ----- 1133 //---- 要计算商品的限购 -----
1116 - if(good['viplimited']>0){ 1134 + if(good['viplimited']>0){
1117 if(cart_num+buynum>good['viplimited']){ 1135 if(cart_num+buynum>good['viplimited']){
1118 err_text+= good['goods_name']+"超出限购\n"; 1136 err_text+= good['goods_name']+"超出限购\n";
1119 continue; 1137 continue;
1120 - } 1138 + }
1121 good['viplimited']-=(cart_num+buynum); 1139 good['viplimited']-=(cart_num+buynum);
1122 if(b_item.goods_num>good['viplimited']){ 1140 if(b_item.goods_num>good['viplimited']){
1123 b_item.goods_num=good['viplimited']; 1141 b_item.goods_num=good['viplimited'];
1124 - } 1142 + }
1125 } 1143 }
1126 -  
1127 - back_goods_arr.push(b_item); //返回商品元素  
1128 - 1144 +
  1145 + back_goods_arr.push(b_item); //返回商品元素
  1146 +
1129 }else{ 1147 }else{
1130 - 1148 +
1131 //-- 看一下购物车上有多少商品 -- 1149 //-- 看一下购物车上有多少商品 --
1132 - var cart_num=0;  
1133 - await getApp().request.promiseGet("/api/weshop/cart/page", { 1150 + var cart_num=0;
  1151 + await getApp().request.promiseGet("/api/weshop/cart/page", {
1134 data: { 1152 data: {
1135 store_id: os.stoid, 1153 store_id: os.stoid,
1136 user_id: getApp().globalData.user_id, 1154 user_id: getApp().globalData.user_id,
1137 state:0, is_gift:0, 1155 state:0, is_gift:0,
1138 - goods_id:good.goods_id 1156 + goods_id:good.goods_id
1139 } 1157 }
1140 }).then(res=>{ 1158 }).then(res=>{
1141 var num = 0; 1159 var num = 0;
@@ -1144,95 +1162,95 @@ Page({ @@ -1144,95 +1162,95 @@ Page({
1144 num += res.data.data.pageData[i].goods_num; 1162 num += res.data.data.pageData[i].goods_num;
1145 } 1163 }
1146 } 1164 }
1147 - cart_num=num; 1165 + cart_num=num;
1148 }) 1166 })
1149 -  
1150 - 1167 +
  1168 +
1151 if(good.store_count<=0){ 1169 if(good.store_count<=0){
1152 err_text+= good['goods_name']+"库存不足\n"; 1170 err_text+= good['goods_name']+"库存不足\n";
1153 - continue; 1171 + continue;
1154 } 1172 }
1155 if(b_item.goods_num>good.store_count) 1173 if(b_item.goods_num>good.store_count)
1156 b_item.goods_num=good.store_count; 1174 b_item.goods_num=good.store_count;
1157 - 1175 +
1158 var buynum=0; //商品已经购买多少件 1176 var buynum=0; //商品已经购买多少件
1159 - var promgoodsbuynum=0; //活动已经购买多少件 1177 + var promgoodsbuynum=0; //活动已经购买多少件
1160 var redis_num = 0; //redis库存 1178 var redis_num = 0; //redis库存
1161 - 1179 +
1162 var req_data={ 1180 var req_data={
1163 store_id: os.stoid, 1181 store_id: os.stoid,
1164 user_id: getApp().globalData.user_id, 1182 user_id: getApp().globalData.user_id,
1165 goods_id: good.goods_id, 1183 goods_id: good.goods_id,
1166 }; 1184 };
1167 - 1185 +
1168 if(prom){ 1186 if(prom){
1169 req_data.prom_type= good.prom_type; 1187 req_data.prom_type= good.prom_type;
1170 req_data.prom_id= good.prom_id; 1188 req_data.prom_id= good.prom_id;
1171 - b_item.prom_type=good.prom_type;  
1172 - b_item.prom_id=good.prom_id; 1189 + b_item.prom_type=good.prom_type;
  1190 + b_item.prom_id=good.prom_id;
1173 //------判断活动是否抢光----- 1191 //------判断活动是否抢光-----
1174 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + 1192 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
1175 os.stoid + "/" + good.prom_type + "/" + good.prom_id, { 1193 os.stoid + "/" + good.prom_type + "/" + good.prom_id, {
1176 1: 1 1194 1: 1
1177 }).then(res => { 1195 }).then(res => {
1178 redis_num = res.data.data; 1196 redis_num = res.data.data;
1179 - }); 1197 + });
1180 if(redis_num<=0){ 1198 if(redis_num<=0){
1181 err_text+= good['goods_name']+"活动不足\n"; 1199 err_text+= good['goods_name']+"活动不足\n";
1182 - continue;  
1183 - }  
1184 - 1200 + continue;
  1201 + }
  1202 +
1185 } 1203 }
1186 - 1204 +
1187 //---要获得商品,该用户买了多少件,同步应用--- 1205 //---要获得商品,该用户买了多少件,同步应用---
1188 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { 1206 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
1189 data: req_data, 1207 data: req_data,
1190 - }).then(res => { 1208 + }).then(res => {
1191 if(res.data.code==0){ 1209 if(res.data.code==0){
1192 var buy_num_data = res.data.data; 1210 var buy_num_data = res.data.data;
1193 if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; 1211 if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
1194 buynum = buy_num_data.goodsbuynum; 1212 buynum = buy_num_data.goodsbuynum;
1195 - }  
1196 - })  
1197 -  
1198 - //---- 要计算商品的限购 -----  
1199 - if(good['viplimited']>0){ 1213 + }
  1214 + })
  1215 +
  1216 + //---- 要计算商品的限购 -----
  1217 + if(good['viplimited']>0){
1200 if(cart_num+buynum>good['viplimited']){ 1218 if(cart_num+buynum>good['viplimited']){
1201 err_text+= good['goods_name']+"超出限购\n"; 1219 err_text+= good['goods_name']+"超出限购\n";
1202 continue; 1220 continue;
1203 - } 1221 + }
1204 good['viplimited']-=(cart_num+buynum); 1222 good['viplimited']-=(cart_num+buynum);
1205 if(b_item.goods_num>good['viplimited']){ 1223 if(b_item.goods_num>good['viplimited']){
1206 b_item.goods_num=good['viplimited']; 1224 b_item.goods_num=good['viplimited'];
1207 } 1225 }
1208 - 1226 +
1209 } 1227 }
1210 - 1228 +
1211 //-- 判断活动的库存 -- 1229 //-- 判断活动的库存 --
1212 - if(prom){ 1230 + if(prom){
1213 if(prom['goods_num']<=prom['buy_num']){ 1231 if(prom['goods_num']<=prom['buy_num']){
1214 err_text+= good['goods_name']+"超出活动库存\n";continue; 1232 err_text+= good['goods_name']+"超出活动库存\n";continue;
1215 - }  
1216 - 1233 + }
  1234 +
1217 if(b_item.goods_num>prom['goods_num']-prom['buy_num']){ 1235 if(b_item.goods_num>prom['goods_num']-prom['buy_num']){
1218 b_item['goods_num']= b_item['goods_num']-b_item['buy_num']; 1236 b_item['goods_num']= b_item['goods_num']-b_item['buy_num'];
1219 } 1237 }
1220 - 1238 +
1221 if(b_item.goods_num>redis_num){ 1239 if(b_item.goods_num>redis_num){
1222 b_item.goods_num=redis_num; 1240 b_item.goods_num=redis_num;
1223 - }  
1224 - 1241 + }
  1242 +
1225 if(cart_num+buynum>prom['buy_limit']){ 1243 if(cart_num+buynum>prom['buy_limit']){
1226 err_text+= good['goods_name']+"超出活动限购\n";continue; 1244 err_text+= good['goods_name']+"超出活动限购\n";continue;
1227 } 1245 }
1228 prom['buy_limit'] -= (cart_num+buynum); 1246 prom['buy_limit'] -= (cart_num+buynum);
1229 if(b_item.goods_num>prom['buy_limit']){ 1247 if(b_item.goods_num>prom['buy_limit']){
1230 - b_item.goods_num=prom['buy_limit']; 1248 + b_item.goods_num=prom['buy_limit'];
1231 } 1249 }
1232 - 1250 +
1233 } 1251 }
1234 - back_goods_arr.push(b_item); //返回商品元素  
1235 - } 1252 + back_goods_arr.push(b_item); //返回商品元素
  1253 + }
1236 } 1254 }
1237 1255
1238 //有重新购买的数据是时候,就要重新生成订单 1256 //有重新购买的数据是时候,就要重新生成订单
pages/user/userinfo/userinfo.wxml
@@ -10,12 +10,12 @@ @@ -10,12 +10,12 @@
10 </view> 10 </view>
11 <view class="flex-center vipmax"> 11 <view class="flex-center vipmax">
12 <view> 12 <view>
13 - <view class="fs32">  
14 - <view class="ellipsis-1 Nickname">{{user.nickname}} 13 + <view>
  14 + <view class="ellipsis-2 Nickname" style="font-size: 31rpx">{{user.nickname}}
15 </view> 15 </view>
16 </view> 16 </view>
17 17
18 - <view class="flex-center fs22 vip"> 18 + <view class="flex fs22 vip">
19 <block wx:if="{{isBool&&gradename}}"> 19 <block wx:if="{{isBool&&gradename}}">
20 <navigator url="/pages/user/userqy/userqy"> 20 <navigator url="/pages/user/userqy/userqy">
21 <view class="flex-center AncrownMax"> 21 <view class="flex-center AncrownMax">
pages/user/userinfo/userinfo.wxss
@@ -48,7 +48,7 @@ input { @@ -48,7 +48,7 @@ input {
48 } 48 }
49 49
50 .Nickname { 50 .Nickname {
51 - max-width: 170rpx; 51 + max-width: 375rpx;
52 } 52 }
53 53
54 .Ancrown { 54 .Ancrown {