Commit fb00a0766210cc6d46ada13a09c3efda3f0a6cde

Authored by yvan.ni
1 parent 4f7a77b8

优惠促销10个bug优化

packageA/pages/prom_list/prom_list.js
@@ -1524,14 +1524,14 @@ Page({ @@ -1524,14 +1524,14 @@ Page({
1524 var cut_pirce=this.data.collocationList[index].shop_price-price; 1524 var cut_pirce=this.data.collocationList[index].shop_price-price;
1525 if(set==1){ 1525 if(set==1){
1526 this.data.dp_price=parseFloat(this.data.dp_price)+price; 1526 this.data.dp_price=parseFloat(this.data.dp_price)+price;
1527 - this.data.cut_pirce=this.data.cut_pirce+cut_pirce; 1527 + this.data.cut_price=this.data.cut_price+cut_pirce;
1528 }else{ 1528 }else{
1529 this.data.dp_price=parseFloat(this.data.dp_price)-price; 1529 this.data.dp_price=parseFloat(this.data.dp_price)-price;
1530 - this.data.cut_pirce=this.data.cut_pirce-cut_pirce; 1530 + this.data.cut_price=this.data.cut_price-cut_pirce;
1531 } 1531 }
1532 price=price.toFixed(2); 1532 price=price.toFixed(2);
1533 cut_pirce=cut_pirce.toFixed(2); 1533 cut_pirce=cut_pirce.toFixed(2);
1534 - this.setData({dp_price: this.data.dp_price,cut_price:this.data.dp_price}); 1534 + this.setData({dp_price: this.data.dp_price,cut_price:this.data.cut_price});
1535 } 1535 }
1536 1536
1537 1537
pages/cart/cart/cart.js
@@ -1229,6 +1229,17 @@ Page({ @@ -1229,6 +1229,17 @@ Page({
1229 } 1229 }
1230 } 1230 }
1231 } 1231 }
  1232 + else{
  1233 + //---条件不到,删除相应的赠品---
  1234 + for(var gi in list.goods){
  1235 + var item=list.goods[gi];
  1236 + if(item.is_gift==1 && item.prom_id==discount.prom_id){
  1237 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  1238 + getApp().request.delete(url, {});
  1239 + list.goods.splice(gi,1);
  1240 + }
  1241 + }
  1242 + }
1232 //-- 获取 -- 1243 //-- 获取 --
1233 await getApp().request.promiseGet("/api/weshop/promgoodslist/list",{ 1244 await getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
1234 data:{prom_id:prom.id} 1245 data:{prom_id:prom.id}
@@ -1243,8 +1254,8 @@ Page({ @@ -1243,8 +1254,8 @@ Page({
1243 make_up_arr.push(elem); break; 1254 make_up_arr.push(elem); break;
1244 } 1255 }
1245 }else{ 1256 }else{
1246 - if(ob.goods_num<item.condition){  
1247 - var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.price).toFixed(2), content:JSON.parse(item.preferential_type)} 1257 + if(ob.num<item.condition){
  1258 + var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.num).toFixed(2), content:JSON.parse(item.preferential_type)}
1248 make_up_arr.push(elem);break; 1259 make_up_arr.push(elem);break;
1249 } 1260 }
1250 } 1261 }
pages/cart/cart/cart.wxml
@@ -87,16 +87,16 @@ @@ -87,16 +87,16 @@
87 <!--- 去凑单 --> 87 <!--- 去凑单 -->
88 <view style="margin-top: 20rpx; padding: 0 30rpx"> 88 <view style="margin-top: 20rpx; padding: 0 30rpx">
89 <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" > 89 <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" >
90 - <view>再买<text class="co-red">{{item.diff}}<text wx:if="{{item.diff_type==0}}">元</text> 90 + <view class="ellipsis-1" style="width: 80%">再买<text class="co-red">{{item.diff}}<text wx:if="{{item.diff_type==0}}">元</text>
91 <text wx:if="{{item.diff_type==1}}">件</text> 91 <text wx:if="{{item.diff_type==1}}">件</text>
92 </text>, 92 </text>,
93 - <text wx:if="{{item.content.is_money}}">免{{item.content.is_money}}元|</text>  
94 - <text wx:if="{{item.content.is_sale}}">打{{item.content.sale}}折|</text>  
95 - <text wx:if="{{item.content.is_past}}">包邮|</text>  
96 - <text wx:if="{{item.content.is_coupon}}">送优惠券|</text>  
97 - <text wx:if="{{item.content.is_int}}">送积分|</text>  
98 - <text wx:if="{{item.content.is_gift}}">送赠品|</text>  
99 - <text wx:if="{{item.content.is_libao}}">送礼包|</text> 93 + <text wx:if="{{item.content.is_money==1}}">免{{item.content.money}}元|</text>
  94 + <text wx:if="{{item.content.is_sale==1}}">打{{item.content.sale}}折|</text>
  95 + <text wx:if="{{item.content.is_past==1}}">包邮|</text>
  96 + <text wx:if="{{item.content.is_coupon==1}}">送优惠券|</text>
  97 + <text wx:if="{{item.content.is_int==1}}">送积分|</text>
  98 + <text wx:if="{{item.content.is_gift==1}}">送赠品|</text>
  99 + <text wx:if="{{item.content.is_libao==1}}">送礼包|</text>
100 <text></text> 100 <text></text>
101 </view> 101 </view>
102 <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view> 102 <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view>
pages/cart/cart2/cart2.js
@@ -1302,6 +1302,8 @@ Page({ @@ -1302,6 +1302,8 @@ Page({
1302 1302
1303 //--------------------提交订单----------------------- 1303 //--------------------提交订单-----------------------
1304 async submitForm(t){ 1304 async submitForm(t){
  1305 + var sub_value=t;
  1306 +
1305 if(this.data.is_summit_ing==1) return false; //--提交中退出-- 1307 if(this.data.is_summit_ing==1) return false; //--提交中退出--
1306 this.data.is_summit_ing=1; 1308 this.data.is_summit_ing=1;
1307 var th=this,pdata=new Array(); 1309 var th=this,pdata=new Array();
@@ -1349,6 +1351,8 @@ Page({ @@ -1349,6 +1351,8 @@ Page({
1349 'exp_type': th.data.bn_exp_type, //配送方式 1351 'exp_type': th.data.bn_exp_type, //配送方式
1350 'order_goods':new Array(), 1352 'order_goods':new Array(),
1351 }; 1353 };
  1354 + //是不是重新提交
  1355 + if(th.data.is_continue==1) item.is_continue=1;
1352 1356
1353 var order_prom_list={}; 1357 var order_prom_list={};
1354 //--判断有没有优惠活动-- 1358 //--判断有没有优惠活动--
@@ -1488,6 +1492,8 @@ Page({ @@ -1488,6 +1492,8 @@ Page({
1488 'exp_type': t_item.exp_type, //配送方式 1492 'exp_type': t_item.exp_type, //配送方式
1489 'order_goods': new Array(), 1493 'order_goods': new Array(),
1490 }; 1494 };
  1495 + //是不是重新提交
  1496 + if(th.data.is_continue==1) item.is_continue=1;
1491 1497
1492 //组装优惠券的钱 1498 //组装优惠券的钱
1493 if(t_item.coupon_price) { 1499 if(t_item.coupon_price) {
@@ -1675,6 +1681,25 @@ Page({ @@ -1675,6 +1681,25 @@ Page({
1675 else{ 1681 else{
1676 //--内容换行-- 1682 //--内容换行--
1677 var msg=data.msg; 1683 var msg=data.msg;
  1684 + //赠品活动已经取消,无法赠送,是否继续买单?
  1685 + if(msg.indexOf("是否继续买单")>0){
  1686 + wx.showModal({
  1687 + title:"提示",
  1688 + content: data.msg,
  1689 + cancelText:'取消',
  1690 + confirmText:'确定',
  1691 + showCancel: true,
  1692 + success(res){
  1693 + if(res.cancel){
  1694 + return;
  1695 + }else if(res.confirm){
  1696 + th.data.is_continue=1;
  1697 + th.submitForm(sub_value);
  1698 + }
  1699 + }
  1700 + })
  1701 + return;
  1702 + }
1678 if(msg.length>13){ 1703 if(msg.length>13){
1679 msg=msg.slice(0, 13) + "\r\n"+ msg.slice(13); 1704 msg=msg.slice(0, 13) + "\r\n"+ msg.slice(13);
1680 } 1705 }
pages/cart/cart2/cart2.wxss
@@ -208,8 +208,8 @@ margin:auto; @@ -208,8 +208,8 @@ margin:auto;
208 height: 100rpx; width: 100%; 208 height: 100rpx; width: 100%;
209 background-color: #fff; 209 background-color: #fff;
210 position: fixed; bottom: 0;left: 0; 210 position: fixed; bottom: 0;left: 0;
211 - border-top:1rpx solid #dee  
212 - 211 + border-top:1rpx solid #dee;
  212 + z-index:9999
213 } 213 }
214 214
215 .tips-btn { 215 .tips-btn {
pages/goods/goodsList/goodsList.js
@@ -60,7 +60,7 @@ Page({ @@ -60,7 +60,7 @@ Page({
60 data:{prom_id:t.prom_id } 60 data:{prom_id:t.prom_id }
61 }).then(res=>{ 61 }).then(res=>{
62 if(res.data.code==0){ 62 if(res.data.code==0){
63 - var arr= res.data.data.pageData; 63 + var arr= res.data.data;
64 th.set_prom_list(arr); 64 th.set_prom_list(arr);
65 } 65 }
66 }) 66 })
@@ -104,32 +104,25 @@ Page({ @@ -104,32 +104,25 @@ Page({
104 var th=this; 104 var th=this;
105 for(var i in arr){ 105 for(var i in arr){
106 //优惠的实际内容 106 //优惠的实际内容
107 - arr[i].preferential_type=JSON.parse(arr[i].preferential_type);  
108 - //--送优惠券-  
109 - if(arr[i].preferential_type.is_coupon){  
110 - //-- 获取券的内容 --  
111 - await getApp().request.promiseGet(" /api/weshop/prom/coupon/get/"+arr[i].coupon, {  
112 - }).then(res => {  
113 - if(res.data.code==0)  
114 - arr[i].quan_name=res.data.data.name;  
115 - })  
116 - } 107 + var content=JSON.parse(arr[i].preferential_type);
  108 + arr[i].content=content;
  109 +
117 //--送礼包-- 110 //--送礼包--
118 - if(arr[i].is_libao) { 111 + if(content.is_libao) {
119 //-- 获取 -- 112 //-- 获取 --
120 - await getApp().request.promiseGet("/api/weshop/libao/libaoForm/page?id="+arr[i].is_libao+"&store_id="+oo.stoid, { 113 + await getApp().request.promiseGet("/api/weshop/libao/libaoForm/page?id="+content.libao+"&store_id="+oo.stoid, {
121 }).then(res => { 114 }).then(res => {
122 if(res.data.code==0) 115 if(res.data.code==0)
123 - arr[i].ib_name=res.data.data.pageData[0].lbtitle; 116 + arr[i].content.lb_name=res.data.data.pageData[0].lbtitle;
124 }) 117 })
125 } 118 }
126 //--送赠品-- 119 //--送赠品--
127 - if(arr[i].is_gift) { 120 + if(content.is_gift) {
128 //-- 获取 -- 121 //-- 获取 --
129 - await getApp().request.promiseGet("/api/weshop/prom/gift/page?id="+arr[i].gift+"&store_id="+oo.stoid, { 122 + await getApp().request.promiseGet("/api/weshop/prom/gift/page?id="+content.gift+"&store_id="+oo.stoid, {
130 }).then(res => { 123 }).then(res => {
131 if(res.data.code==0) 124 if(res.data.code==0)
132 - arr[i].gift_name=res.data.data.pageData[0].goods_name; 125 + arr[i].content.gift_name=res.data.data.pageData[0].goods_name;
133 }) 126 })
134 } 127 }
135 } 128 }
pages/goods/goodsList/goodsList.wxml
1 <wxs module="g_filter" src="g_filter.wxs"></wxs> 1 <wxs module="g_filter" src="g_filter.wxs"></wxs>
2 <view class="container"> 2 <view class="container">
3 - <view>  
4 -  
5 - <view> 满50.00元 减5元 包邮 送10积分 送8元优惠券 送海飞丝洗发水丝质 顺滑& </view>  
6 - 3 + <view style="padding: 20rpx 30rpx">
  4 + <block wx:for="{{prom_goods_list}}">
  5 + <view class="fs30 ellipsis-1">
  6 + 满{{item.condition}}<text space="{{true}}" wx:if="{{item.prom_type==0}}">元 </text> <text space="{{true}}" wx:else>件 </text>
  7 + <text space="{{true}}" wx:if="{{item.content.is_money}}">减{{item.content.money}}元 </text>
  8 + <text space="{{true}}" wx:if="{{item.content.is_sale}}">打{{item.content.sale}}折 </text>
  9 + <text space="{{true}}" wx:if="{{item.content.is_int}}">送{{item.content.int}}积分 </text>
  10 + <text space="{{true}}" wx:if="{{item.content.is_coupon}}">送{{item.content.coupon}}元优惠券 </text>
  11 + <text space="{{true}}" wx:if="{{item.content.is_gift}}">送{{item.content.gift_name}} </text>
  12 + <text space="{{true}}" wx:if="{{item.content.is_libao}}">送{{item.content.lb_name}} </text>
  13 + </view>
  14 + </block>
7 </view> 15 </view>
8 16
9 -  
10 -  
11 -  
12 -  
13 <view class="nav"> 17 <view class="nav">
14 <navigator bindtap="changeTab" class="nav-item" data-href="goods_id" data-ad="{{adname}}">综合 18 <navigator bindtap="changeTab" class="nav-item" data-href="goods_id" data-ad="{{adname}}">综合
15 <view class="ico-dg" wx:if="{{tabname=='goods_id'}}"> 19 <view class="ico-dg" wx:if="{{tabname=='goods_id'}}">
pages/user/order_detail/order_detail.js
@@ -259,24 +259,19 @@ Page({ @@ -259,24 +259,19 @@ Page({
259 259
260 //--------确认收货--------- 260 //--------确认收货---------
261 confirmOrder: function(e) { 261 confirmOrder: function(e) {
  262 + var th=this;
262 var t = this, o = this.data.order.order_id,order=this.data.order; 263 var t = this, o = this.data.order.order_id,order=this.data.order;
263 var is_zsorder=order.is_zsorder; 264 var is_zsorder=order.is_zsorder;
264 wx.showModal({ 265 wx.showModal({
265 title: "是否确认收货?", 266 title: "是否确认收货?",
266 - success: function(e) {  
267 - e.confirm && r.put("/api/weshop/order/updatebyId", {  
268 - data: {  
269 - order_id: o, order_status: 2  
270 - },  
271 - success: function(e) {  
272 - t.requestOrderDetail(o), wx.setStorageSync("order:order_list:update", !0);  
273 - //如果是会员团订单  
274 - if(is_zsorder==3){  
275 - getApp().request.post("/api/weshop/order/vipTuanTebate/"+os.stoid+"/"+o,{  
276 - data:{}, success:function () { }})  
277 - } 267 + success: function(t) {
  268 + t.confirm && rq.post("/api/weshop/order/confirmOrder/"+os.stoid+"/"+o+"/"+getApp().globalData.user_id,{
  269 + success:function (e) {
  270 + if(e.data.code==0){
  271 + th.requestOrderDetail(o)
  272 + }
278 } 273 }
279 - }); 274 + })
280 } 275 }
281 }); 276 });
282 }, 277 },
pages/user/order_detail/order_detail.wxml
@@ -110,6 +110,11 @@ @@ -110,6 +110,11 @@
110 <view> ¥ {{order.integral_money}}元</view> 110 <view> ¥ {{order.integral_money}}元</view>
111 </view> 111 </view>
112 112
  113 + <view class="item pnew" wx:if="{{order.discount_amount>0}}">
  114 + <view>优惠活动</view>
  115 + <view>¥ {{order.discount_amount}}元</view>
  116 + </view>
  117 +
113 <view class="item pnew" wx:if="{{order.order_prom_amount>0}}"> 118 <view class="item pnew" wx:if="{{order.order_prom_amount>0}}">
114 <view>订单优惠</view> 119 <view>订单优惠</view>
115 <view>¥ {{order.order_prom_amount}}元</view> 120 <view>¥ {{order.order_prom_amount}}元</view>
@@ -150,7 +155,7 @@ @@ -150,7 +155,7 @@
150 </block> 155 </block>
151 <block wx:else> 156 <block wx:else>
152 <view class="tips-btn" wx:if="{{order.is_all_return_status==2 && order.isdel==0}}" bindtap="deleteOrderData" data-order_id="{{order.order_id}}" >删除订单</view> 157 <view class="tips-btn" wx:if="{{order.is_all_return_status==2 && order.isdel==0}}" bindtap="deleteOrderData" data-order_id="{{order.order_id}}" >删除订单</view>
153 - <navigator class="tips-btn" wx:if="{{order.is_all_return_status==3}}" url="/pages/order/refund_order/refund_order?order_id={{order.order_id}}">重新退款</navigator> 158 + <navigator class="tips-btn" wx:if="{{order.is_all_return_status==3 && order.order_status<2}}" url="/pages/order/refund_order/refund_order?order_id={{order.order_id}}">重新退款</navigator>
154 <navigator class="tips-btn" wx:if="{{order.is_all_return_status==0 || order.is_all_return_status==1}}" 159 <navigator class="tips-btn" wx:if="{{order.is_all_return_status==0 || order.is_all_return_status==1}}"
155 url="/pages/user/return_goods_info/return_goods_info?order_id={{order.order_id}}">退款详情</navigator> 160 url="/pages/user/return_goods_info/return_goods_info?order_id={{order.order_id}}">退款详情</navigator>
156 </block> 161 </block>
pages/user/order_list/order_list.js
@@ -286,22 +286,14 @@ Page({ @@ -286,22 +286,14 @@ Page({
286 wx.showModal({ 286 wx.showModal({
287 title: "是否确认收货?", 287 title: "是否确认收货?",
288 success: function(t) { 288 success: function(t) {
289 - t.confirm && rq.put("/api/weshop/order/updatebyId", {  
290 - data: {  
291 - order_id: a,  
292 - order_status: 2  
293 - },  
294 - success: function(t) {  
295 - e.deleteOrderData2(a);  
296 - //如果是会员团订单  
297 - if (is_zsorder == 3) {  
298 - getApp().request.post("/api/weshop/order/vipTuanTebate/" + os.stoid + "/" + a, {  
299 - data: {},  
300 - success: function() {}  
301 - }) 289 + t.confirm && rq.post("/api/weshop/order/confirmOrder/"+os.stoid+"/"+a+"/"+getApp().globalData.user_id,{
  290 + success:function (e) {
  291 + if(e.data.code==0){
  292 + th.deleteOrderData2(a);
  293 + getApp().confirmBox( "确认收货成功!");
  294 + }
302 } 295 }
303 - }  
304 - }); 296 + })
305 } 297 }
306 }); 298 });
307 }, 299 },
@@ -315,7 +307,7 @@ Page({ @@ -315,7 +307,7 @@ Page({
315 var order=th.data.orderList[index]; 307 var order=th.data.orderList[index];
316 if(order.order_status!=6){ 308 if(order.order_status!=6){
317 up_data.order_status=5; 309 up_data.order_status=5;
318 - } 310 + }
319 wx.showModal({ 311 wx.showModal({
320 title: "是否删除订单?", 312 title: "是否删除订单?",
321 success: function(tt) { 313 success: function(tt) {
pages/user/order_list/order_list.wxml
@@ -115,7 +115,8 @@ @@ -115,7 +115,8 @@
115 <view class="commodity_money flex baseline" wx:else> 115 <view class="commodity_money flex baseline" wx:else>
116 <view>合计:</view> 116 <view>合计:</view>
117 <view class="fs24 xc-wc">¥</view> 117 <view class="fs24 xc-wc">¥</view>
118 - <view class="xc-wc">{{filters.toFix(item.order_amount+item.user_money,2)}} 118 + <view class="xc-wc">{{filters.toFix(item.order_amount+item.user_money,2)}}
  119 + <text wx:if="{{item.coupon_price}}">+{{item.coupon_price}}元优惠券</text>
119 </view> 120 </view>
120 </view> 121 </view>
121 <view wx:if="{{item.pt_tail_money>0}}" class="commodity_money flex baseline"> 122 <view wx:if="{{item.pt_tail_money>0}}" class="commodity_money flex baseline">
@@ -124,6 +125,8 @@ @@ -124,6 +125,8 @@
124 <view class="xc-wc">{{filters.toFix(item.pt_tail_money-item.shipping_price,2)}} 125 <view class="xc-wc">{{filters.toFix(item.pt_tail_money-item.shipping_price,2)}}
125 </view> 126 </view>
126 </view> 127 </view>
  128 +
  129 +
127 </block> 130 </block>
128 </view> 131 </view>
129 </view> 132 </view>
@@ -139,7 +142,7 @@ @@ -139,7 +142,7 @@
139 </block> 142 </block>
140 <block wx:else> 143 <block wx:else>
141 <view class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==2 && item.isdel==0}}" bindtap="deleteOrderData" data-order_id="{{item.order_id}}" data-index="{{index}}">删除订单</view> 144 <view class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==2 && item.isdel==0}}" bindtap="deleteOrderData" data-order_id="{{item.order_id}}" data-index="{{index}}">删除订单</view>
142 - <navigator class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==3}}" url="/pages/order/refund_order/refund_order?order_id={{item.order_id}}">重新退款</navigator> 145 + <navigator class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==3 && item.order_status<2}}" url="/pages/order/refund_order/refund_order?order_id={{item.order_id}}">重新退款</navigator>
143 <navigator class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==0 || item.is_all_return_status==1}}" url="/pages/user/return_goods_info/return_goods_info?order_id={{item.order_id}}">退款详情</navigator> 146 <navigator class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==0 || item.is_all_return_status==1}}" url="/pages/user/return_goods_info/return_goods_info?order_id={{item.order_id}}">退款详情</navigator>
144 </block> 147 </block>
145 <navigator class="commodity_To_evaluate flex-level View_evaluation" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==1)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator> 148 <navigator class="commodity_To_evaluate flex-level View_evaluation" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==1)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator>