Commit 0d90551460fb2bb44377485616fc55418f023a34

Authored by yvan.ni
1 parent 2a731e67

1. 取消订单

2.  购物车控制送赠品的数量,要小于库存和小于限购
3.  提交订单因为有满0元就可以使用的券的bug优化
packageA/pages/prom_list/prom_list.wxml
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 <!-- 左边 --> 46 <!-- 左边 -->
47 <view style="text-align: left; padding-left: 20rpx"> 47 <view style="text-align: left; padding-left: 20rpx">
48 <view class="co-red"><text class="f_hei">搭配价</text>¥{{filters.toFix(data.shop_price+dp_price,2)}}</view> 48 <view class="co-red"><text class="f_hei">搭配价</text>¥{{filters.toFix(data.shop_price+dp_price,2)}}</view>
49 - <view class="co-red"><text class="f_hei">已省</text>¥{{cut_price}}</view> 49 + <view class="co-red"><text class="f_hei">已省</text>¥{{filters.toFix(cut_price,2)}}</view>
50 </view> 50 </view>
51 <!-- 右边 --> 51 <!-- 右边 -->
52 <view bindtap="openSpecModel" class="buy_btn ">立即购买</view> 52 <view bindtap="openSpecModel" class="buy_btn ">立即购买</view>
pages/cart/cart/cart.js
@@ -55,9 +55,9 @@ Page({ @@ -55,9 +55,9 @@ Page({
55 }, 55 },
56 onShow: function() { 56 onShow: function() {
57 var th = this; 57 var th = this;
58 - th.setData({  
59 - isTabBar: getApp().globalData.isTabBar,  
60 - }); 58 + //th.setData({
  59 + // isTabBar: getApp().globalData.isTabBar,
  60 + //});
61 61
62 t.editTabBar(); //显示自定义的底部导航 62 t.editTabBar(); //显示自定义的底部导航
63 this.getCardList(); 63 this.getCardList();
@@ -78,7 +78,6 @@ Page({ @@ -78,7 +78,6 @@ Page({
78 }) 78 })
79 } 79 }
80 }); 80 });
81 - isTabBar  
82 81
83 }, 82 },
84 83
@@ -1191,8 +1190,9 @@ Page({ @@ -1191,8 +1190,9 @@ Page({
1191 }).then(res=>{ 1190 }).then(res=>{
1192 if(res.data.code==0) discount=res.data.data; 1191 if(res.data.code==0) discount=res.data.data;
1193 }) 1192 })
1194 - //---如果有打折的信息,赠送的信息---  
1195 - if(discount && discount['goods_id']){ 1193 +
  1194 + //---如果有打折的信息,赠送的信息,赠送的时候要判断是不是限购数量---
  1195 + if(discount && discount['goods_id'] && discount.limit_num>=discount.bs && discount.gift_storecount>=discount.bs){
1196 var o=discount.goodsinfo; 1196 var o=discount.goodsinfo;
1197 var newd = { 1197 var newd = {
1198 goods_id: o.goods_id, 1198 goods_id: o.goods_id,
pages/cart/cart2/cart2.js
@@ -717,7 +717,7 @@ Page({ @@ -717,7 +717,7 @@ Page({
717 if(item_map.s_coupon_id){ 717 if(item_map.s_coupon_id){
718 if(!cart_item.s_coupon_id) { 718 if(!cart_item.s_coupon_id) {
719 cart_item.s_coupon_id=item_map.s_coupon_id+""; 719 cart_item.s_coupon_id=item_map.s_coupon_id+"";
720 - cart_item.g_coupon_num=[{'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num}]; 720 + cart_item.g_coupon_num=[{'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_nums_coupon_num}];
721 } 721 }
722 else{ 722 else{
723 cart_item.s_coupon_id+=","+item_map.s_coupon_id; 723 cart_item.s_coupon_id+=","+item_map.s_coupon_id;
@@ -840,12 +840,12 @@ Page({ @@ -840,12 +840,12 @@ Page({
840 if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1){ 840 if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1){
841 continue; 841 continue;
842 } 842 }
843 -  
844 //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- 843 //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算--
845 if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1 && !is_good_no_by){ 844 if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1 && !is_good_no_by){
846 continue; 845 continue;
847 } 846 }
848 847
  848 +
849 //----------------如果是选择了物流--------------------- 849 //----------------如果是选择了物流---------------------
850 if(cart_item.exp_type == 0 && item[j].is_free_shipping==0){ 850 if(cart_item.exp_type == 0 && item[j].is_free_shipping==0){
851 //如果地址不为空 851 //如果地址不为空
@@ -2364,6 +2364,7 @@ Page({ @@ -2364,6 +2364,7 @@ Page({
2364 //-----获取购物车进来的劵------- 2364 //-----获取购物车进来的劵-------
2365 get_cart_quan:function () { 2365 get_cart_quan:function () {
2366 var th=this; 2366 var th=this;
  2367 + var is_xz_yh=1;
2367 //等待值的出现 2368 //等待值的出现
2368 getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { 2369 getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () {
2369 var arr=th.data.order_prom_list_cart; 2370 var arr=th.data.order_prom_list_cart;
@@ -2387,6 +2388,7 @@ Page({ @@ -2387,6 +2388,7 @@ Page({
2387 //如果有限制使用优惠券,就要返回 2388 //如果有限制使用优惠券,就要返回
2388 if(gd.prom_type==3){ 2389 if(gd.prom_type==3){
2389 if(th.data.prom_goods_map[pickup_id][gd.prom_id].is_xz_yh) continue; 2390 if(th.data.prom_goods_map[pickup_id][gd.prom_id].is_xz_yh) continue;
  2391 + is_xz_yh=0;
2390 th.data.prom_goods_map[pickup_id][gd.prom_id].coupon_sele=1; 2392 th.data.prom_goods_map[pickup_id][gd.prom_id].coupon_sele=1;
2391 } 2393 }
2392 var item_price=gd.goods_price*gd.goods_num; 2394 var item_price=gd.goods_price*gd.goods_num;
@@ -2418,7 +2420,7 @@ Page({ @@ -2418,7 +2420,7 @@ Page({
2418 arr[ind].check_quan_price_list=check_quan_price_list; 2420 arr[ind].check_quan_price_list=check_quan_price_list;
2419 2421
2420 //是否关闭使用优惠券 2422 //是否关闭使用优惠券
2421 - if (th.data.is_close_quan != 1) { 2423 + if (th.data.is_close_quan != 1 && !is_xz_yh) {
2422 //--调用接口,获取优惠券的列表,3秒钟内控制接口请求-- 2424 //--调用接口,获取优惠券的列表,3秒钟内控制接口请求--
2423 var url="/api/weshop/couponList/getUseCouponList"; 2425 var url="/api/weshop/couponList/getUseCouponList";
2424 await app.request.promiseGet(url,{ data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:ckeck_quan_price,WareIds:check_quan_ware_list,pageSize:100}}).then(res=>{ 2426 await app.request.promiseGet(url,{ data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:ckeck_quan_price,WareIds:check_quan_ware_list,pageSize:100}}).then(res=>{
pages/user/order_detail/order_detail.js
@@ -235,15 +235,13 @@ Page({ @@ -235,15 +235,13 @@ Page({
235 if(!e.confirm) return false; 235 if(!e.confirm) return false;
236 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单 236 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单
237 //if(is_skill==1 || is_zsorder>=2){ 237 //if(is_skill==1 || is_zsorder>=2){
238 -  
239 - getApp().request.delete("/api/weshop/order/cancelTeamOrder/"+os.stoid+"/"+o,{ 238 + getApp().request.post("/api/weshop/order/cancelOrder/"+os.stoid+"/"+o+"/"+getApp().globalData.user_id,{
240 data:{}, 239 data:{},
241 success: function(t) { 240 success: function(t) {
242 if(t.data.code==0) 241 if(t.data.code==0)
243 th.requestOrderDetail(o), wx.setStorageSync("order:order_list:update", !0); 242 th.requestOrderDetail(o), wx.setStorageSync("order:order_list:update", !0);
244 }, 243 },
245 }) 244 })
246 -  
247 /*---- 245 /*----
248 }else{ 246 }else{
249 getApp().request.put("/api/weshop/order/updatebyId", { 247 getApp().request.put("/api/weshop/order/updatebyId", {
pages/user/order_list/order_list.js
@@ -261,7 +261,7 @@ Page({ @@ -261,7 +261,7 @@ Page({
261 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单 261 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单
262 if (t.confirm) { 262 if (t.confirm) {
263 //if(is_skill==1 || is_zsorder>=2){ 263 //if(is_skill==1 || is_zsorder>=2){
264 - getApp().request.delete("/api/weshop/order/cancelTeamOrder/" + os.stoid + "/" + a, { 264 + getApp().request.post("/api/weshop/order/cancelOrder/"+os.stoid+"/"+a+"/"+getApp().globalData.user_id, {
265 data: {}, 265 data: {},
266 success: function(t) { 266 success: function(t) {
267 if (t.data.code == 0) { 267 if (t.data.code == 0) {
@@ -600,6 +600,7 @@ Page({ @@ -600,6 +600,7 @@ Page({
600 600
601 601
602 pay_next(e){ 602 pay_next(e){
  603 + var th=this;
603 if (e.order_amount == 0) { 604 if (e.order_amount == 0) {
604 var dd = { 605 var dd = {
605 parent_sn: e.order_sn, 606 parent_sn: e.order_sn,