Commit 7d788d945b877feba49c9e6765d64c96dd655278

Authored by taiyuan
2 parents e8ae79bc 02bfb03f

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

packageB/pages/zuhegou/index/index.js
... ... @@ -472,34 +472,61 @@ Page({
472 472 var txt2 = "list[" + index + "].showNum";
473 473 th.data.sele_g = this.data.list[index];
474 474  
475   -
476 475 wx.showModal({
477 476 title: '温馨提示',
478   - content: '确定将该商品移出购物车?',
  477 + content: "确定取消该商品参与活动?",
479 478 success (res) {
480 479 if (res.confirm) {
481 480 console.log('用户点击确定');
  481 + if(th.data.sele_g.cart_num){
482 482  
483   - var url = '/api/weshop/cart/del/' + os.stoid + '/' + th.data.sele_g.cart_id;
484   - getApp().request.delete(url, {
485   - success:function (res) {
486   -
487   - if(res.data.code==0) {
488   - title = '移除购物车成功';
489   - th.setData({
490   - [txt1]: 1,
491   - [txt2]: false,
492   - [txt]: false,
493   - });
494   - wx.showToast({
495   - title: title,
496   - icon: 'success',
497   - });
498   -
499   - th.re_sum_price();
500   - }
  483 + var updata = {
  484 + id: th.data.sele_g.cart_id,
  485 + goods_num: th.data.sele_g.cart_num - th.data.sele_g.num,
  486 + store_id: os.stoid
501 487 }
502   - });
  488 + getApp().request.put("/api/weshop/cart/update", {
  489 + data: updata,
  490 + success:function (rs) {
  491 + if(rs.data.code==0) {
  492 + title = '取消成功';
  493 + th.setData({
  494 + [txt1]: 0,
  495 + [txt2]: false,
  496 + [txt]: false,
  497 + });
  498 + wx.showToast({
  499 + title: title,
  500 + icon: 'success',
  501 + });
  502 + th.re_sum_price();
  503 + }
  504 + }
  505 + })
  506 +
  507 + }else{
  508 + var url = '/api/weshop/cart/del/' + os.stoid + '/' + th.data.sele_g.cart_id;
  509 + getApp().request.delete(url, {
  510 + success:function (res) {
  511 +
  512 + if(res.data.code==0) {
  513 + title = '取消成功';
  514 + th.setData({
  515 + [txt1]: 0,
  516 + [txt2]: false,
  517 + [txt]: false,
  518 + });
  519 + wx.showToast({
  520 + title: title,
  521 + icon: 'success',
  522 + });
  523 +
  524 + th.re_sum_price();
  525 + }
  526 + }
  527 + });
  528 + }
  529 +
503 530 } else if (res.cancel) {
504 531 console.log('用户点击取消')
505 532 self.setData({
... ... @@ -551,6 +578,7 @@ Page({
551 578 var index = e.currentTarget.dataset.index;
552 579 var item = this.data.list[index];
553 580 let num = item.num;
  581 + th.data.s_cart_num = this.data.sele_g.cart_num - 1;
554 582  
555 583 if (num >= 2) {
556 584 var check_num = num - 1;
... ... @@ -569,7 +597,7 @@ Page({
569 597 th.data.sele_g = item;
570 598 th.data.sele_index = index;
571 599 th.data.goodsInputNum = check_num;
572   - th.data.s_cart_num = this.data.sele_g.cart_num - 1;
  600 +
573 601 th.sub_updata_cart();
574 602 return false;
575 603 }
... ... @@ -580,27 +608,54 @@ Page({
580 608  
581 609 wx.showModal({
582 610 title: '温馨提示',
583   - content: '确定将该商品移出购物车?',
  611 + content: '确定取消该商品参与活动?',
584 612 success (res) {
585 613 if (res.confirm) {
586   - var url = '/api/weshop/cart/del/' + os.stoid + '/' + item.cart_id;
587   - getApp().request.delete(url, {
588   - success:function (res) {
589   - if(res.data.code==0) {
590   - var title = '移除购物车成功';
591   - th.setData({
592   - [txt1]: 1,
593   - [txt2]: false,
594   - [txt]: false,
595   - });
596   - wx.showToast({
597   - title: title,
598   - icon: 'success',
599   - });
600   - th.re_sum_price();//重新统计数量和总金额
601   - }
  614 +
  615 + if(th.data.s_cart_num){
  616 + var updata = {
  617 + id: th.data.sele_g.cart_id,
  618 + goods_num:h.data.s_cart_num ,
  619 + store_id: os.stoid
602 620 }
603   - });
  621 + getApp().request.put("/api/weshop/cart/update", {
  622 + data: updata,
  623 + success:function (rs) {
  624 + if(rs.data.code==0) {
  625 + var title = '取消成功';
  626 + th.setData({
  627 + [txt1]: 0,
  628 + [txt2]: false,
  629 + [txt]: false,
  630 + });
  631 + wx.showToast({
  632 + title: title,
  633 + icon: 'success',
  634 + });
  635 + th.re_sum_price();
  636 + }
  637 + }
  638 + })
  639 + }else {
  640 + var url = '/api/weshop/cart/del/' + os.stoid + '/' + item.cart_id;
  641 + getApp().request.delete(url, {
  642 + success: function (res) {
  643 + if (res.data.code == 0) {
  644 + var title = '移除购物车成功';
  645 + th.setData({
  646 + [txt1]: 1,
  647 + [txt2]: false,
  648 + [txt]: false,
  649 + });
  650 + wx.showToast({
  651 + title: title,
  652 + icon: 'success',
  653 + });
  654 + th.re_sum_price();//重新统计数量和总金额
  655 + }
  656 + }
  657 + });
  658 + }
604 659  
605 660 } else if (res.cancel) {
606 661 console.log('用户点击取消')
... ... @@ -844,6 +899,10 @@ Page({
844 899 goods_sn: o.goods_sn,
845 900 };
846 901  
  902 + if(th.data.s_cart_num){
  903 + newd.goods_num=th.data.s_cart_num;
  904 + }
  905 +
847 906 //---是不是从收藏夹出来的---
848 907 if (th.data.c_guide_id) {
849 908 newd['guide_id'] = th.data.c_guide_id;
... ... @@ -951,6 +1010,12 @@ Page({
951 1010 });
952 1011 th.data.adding = 0;
953 1012 th.data.sele_store = 1;
  1013 +
  1014 + if(th.data.s_cart_num){
  1015 + var txt_temp = "list[" + index + "].cart_num";
  1016 + th.setData({[txt_temp]:th.data.s_cart_num})
  1017 + }
  1018 +
954 1019 th.re_sum_price();//重新统计数量和总金额
955 1020 }
956 1021 });
... ... @@ -1470,8 +1535,8 @@ Page({
1470 1535 store_id: os.stoid,
1471 1536 user_id: user_id,
1472 1537 goods_id: gd.goods_id,
1473   - prom_type: gd.prom_type,
1474   - prom_id: gd.prom_id
  1538 + prom_type: 7,
  1539 + prom_id: th.data.act.id
1475 1540 },
1476 1541 }).then(res2=>{
1477 1542 var g_buy_num=0;
... ... @@ -1540,6 +1605,11 @@ Page({
1540 1605 });
1541 1606 th.data.adding = 0;
1542 1607 th.data.sele_store = 1;
  1608 + if(th.data.s_cart_num){
  1609 + var txt_temp = "list[" + index + "].cart_num";
  1610 + th.setData({[txt_temp]:th.data.s_cart_num})
  1611 + }
  1612 +
1543 1613 th.re_sum_price();//重新统计数量和总金额
1544 1614 }
1545 1615 });
... ... @@ -1594,7 +1664,7 @@ Page({
1594 1664 if(check_obj.prom_buybum && check_obj.prom_buybum>0) prom_buybum=check_obj.prom_buybum;
1595 1665  
1596 1666 if(check_obj){
1597   - if(check_obj.prom_buybum && check_obj.prom_buybum>th.data.sele_g.buyqty &&
  1667 + if(check_obj.prom_buybum && check_obj.prom_buybum>=th.data.sele_g.buyqty &&
1598 1668 th.data.sele_g.buyqty>0
1599 1669 ){
1600 1670 wx.showToast({
... ... @@ -1604,7 +1674,7 @@ Page({
1604 1674 });
1605 1675 return false;
1606 1676 }
1607   - if(check_obj.gd_buynum && check_obj.gd_buynum>th.data.sele_g.viplimited &&
  1677 + if(check_obj.gd_buynum && check_obj.gd_buynum>=th.data.sele_g.viplimited &&
1608 1678 th.data.sele_g.viplimited>0
1609 1679 ){
1610 1680 wx.showToast({
... ... @@ -1616,12 +1686,12 @@ Page({
1616 1686 }
1617 1687 }
1618 1688  
1619   - item.cbuy=-1;
1620   - var cbuy=th.data.sele_g.viplimited>0?th.data.sele_g.viplimited-gd_buynum:-1;
1621   - if(cbuy>-1) item.cbuy=cbuy;
1622   - var cbuy2=th.data.sele_g.buyqty>0?th.data.sele_g.buyqty-prom_buybum:-1;
1623   - if(cbuy2>-1){
1624   - if(item.cbuy==-1 || item.cbuy>cbuy2) item.cbuy=cbuy2;
  1689 + item.cbuy='no';
  1690 + var cbuy=th.data.sele_g.viplimited>0?th.data.sele_g.viplimited-gd_buynum:'no';
  1691 + if(cbuy!='no') item.cbuy=cbuy;
  1692 + var cbuy2=th.data.sele_g.buyqty>0?th.data.sele_g.buyqty-prom_buybum:'no';
  1693 + if(cbuy2!='no'){
  1694 + if(item.cbuy=='no' || item.cbuy>cbuy2) item.cbuy=cbuy2;
1625 1695 }
1626 1696  
1627 1697 var num=item.goods_num;
... ... @@ -1637,17 +1707,12 @@ Page({
1637 1707 [txt5]: item.goods_num,
1638 1708 });
1639 1709  
1640   - if(item.cbuy>-1){
1641   - th.setData({
1642   - [txt5]: item.cbuy,
1643   - });
1644   - }
1645   -
1646 1710 var updata = {
1647 1711 id: item.id,
1648 1712 prom_type: 7,
1649 1713 goods_price: cur_price,
1650   - prom_id: th.data.act.id
  1714 + prom_id: th.data.act.id,
  1715 + store_id: os.stoid,
1651 1716 };
1652 1717 if (getApp().globalData.guide_id) {
1653 1718 updata['guide_id'] = getApp().globalData.guide_id;
... ...
pages/activity/seckill_list/seckill_list.js
... ... @@ -17,9 +17,13 @@ Page({
17 17  
18 18 //------初始化加载----------
19 19 onLoad: function(t) {
20   - wx.setNavigationBarTitle({ title: "商品秒杀",})
21   -
  20 + wx.setNavigationBarTitle({ title: "商品秒杀",})
22 21 var first_leader = t.first_leader;
  22 + var type=t.type;
  23 + if(type!=undefined){
  24 + this.setData({type:type});
  25 + }
  26 +
23 27 var th=this;
24 28  
25 29 console.log("------------");
... ... @@ -129,8 +133,17 @@ Page({
129 133 });
130 134  
131 135 if(plist.length<=0){
  136 +
132 137 getApp().showWarning("没有更多数据");
133 138 th.data.ismore=0;
  139 + if(e.data.currentPage==1 && this.data.type==1){
  140 + setTimeout(function () {
  141 + th.data.ismore=1;
  142 + th.setData({type:0});
  143 + th.requestSalelist();
  144 + },1000);
  145 + }
  146 + return false;
134 147 }
135 148  
136 149 //--循环读取接口---
... ... @@ -147,7 +160,7 @@ Page({
147 160 alllist.push(plist[i]);
148 161 }
149 162 e.data.currentPage++;
150   - console.log("秒杀商品列表", alllist);
  163 + console.log("秒杀商品列表", alllist);
151 164 th.setData({goodlist:alllist,isshow:1});
152 165  
153 166 },
... ...
pages/activity/seckill_list/seckill_list.wxml
... ... @@ -84,11 +84,11 @@
84 84 <view class="theader" >
85 85 <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}">
86 86 <image class="xc-bottom"
87   - src="{{type==1?'{{url}}/miniapp/images/fire-red.png':'{{url}}/miniapp/images/fire-black.png'}}"></image>
  87 + src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image>
88 88 火热进行中</view>
89 89 <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}">
90 90 <image class="xc-bottom"
91   - src="{{type==0?'{{url}}/miniapp/images/clock-rad.png':'{{url}}/miniapp/images/clock-black.png'}}"></image>
  91 + src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image>
92 92 即将开始</view>
93 93 </view>
94 94 </view>
... ...
pages/cart/cart/cart.js
... ... @@ -198,6 +198,7 @@ Page({
198 198 get_cart: function() {
199 199 var th = this;
200 200 var rd = Math.random().toString(36).substr(2, 15);
  201 + var user_id=getApp().globalData.userInfo.user_id;
201 202 getApp().request.get("/api/weshop/cart/list", {
202 203 data: {
203 204 user_id: app.globalData.user_id,
... ... @@ -249,6 +250,40 @@ Page({
249 250 //商品已经下架
250 251 continue;
251 252 }
  253 + var goodsbuynum=0,promgoodsbuynum=0,limit=0;
  254 +
  255 + //--要获得商品,该用户买了多少件,同步应用--
  256 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  257 + data: {
  258 + store_id: oo.stoid,
  259 + user_id: user_id,
  260 + goods_id: item.goods_id,
  261 + prom_type: item.prom_type,
  262 + prom_id: item.prom_id
  263 + },
  264 + }).then(res => {
  265 + var buy_num_data = res.data.data;
  266 + if (buy_num_data.promgoodsbuynum) {
  267 + promgoodsbuynum = buy_num_data.promgoodsbuynum;
  268 + }
  269 + goodsbuynum = buy_num_data.goodsbuynum;
  270 + })
  271 + limit=good.viplimited;
  272 + //判断商品的限购
  273 + if(item.goods_num+goodsbuynum>limit && limit>0){
  274 + var cbuy=limit-goodsbuynum;
  275 + if(cbuy<=0){
  276 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  277 + a.delete(url, {});
  278 + continue;
  279 + }
  280 + //-- 购物车更新 --
  281 + var updata1={id: item.id,goods_num:cbuy };
  282 + getApp().request.put("/api/weshop/cart/update", {
  283 + data: updata1,
  284 + })
  285 + item.goods_num=cbuy;
  286 + }
252 287  
253 288 //如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着
254 289 if (item.prom_type == 1) {
... ... @@ -266,6 +301,22 @@ Page({
266 301 //商品已经下架
267 302 continue;
268 303 }
  304 +
  305 + //判断秒杀的限购
  306 + if(item.goods_num+promgoodsbuynum>prom.buy_limit && prom.buy_limit>0){
  307 + var cbuy=prom.buy_limit-promgoodsbuynum;
  308 + if(cbuy<=0){
  309 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  310 + a.delete(url, {});
  311 + continue;
  312 + }
  313 + //-- 购物车更新 --
  314 + var updata1={id: item.id,goods_num:cbuy };
  315 + getApp().request.put("/api/weshop/cart/update", {
  316 + data: updata1,
  317 + })
  318 + item.goods_num=cbuy;
  319 + }
269 320 }
270 321 //--判断优惠活动有没有过期--
271 322 else if (item.prom_type == 3) {
... ... @@ -330,6 +381,25 @@ Page({
330 381 getApp().request.delete(url, {});
331 382 continue;
332 383 }
  384 + item.zh_b_num=promgoodsbuynum;
  385 +
  386 + var url1 = "/api/weshop/prom/zhbuyGoods/page";
  387 + var req_data = {
  388 + page: 1,
  389 + pageSize: 2000,
  390 + store_id: os.stoid,
  391 + zh_id: item.prom_id,
  392 + goods_id:item.goods_id
  393 + }
  394 + await getApp().request.promiseGet(url1, {
  395 + data: req_data
  396 + }).then(res => {
  397 + if (ut.ajax_ok(res)) {
  398 + gdlist = res.data.data.pageData[0];
  399 + item.buyqty=gdlist.buyqty;
  400 + }
  401 + })
  402 +
333 403 }
334 404 else if(item.prom_type == 0) {
335 405 //如果有优惠活动,要更新活动
... ... @@ -348,6 +418,7 @@ Page({
348 418 })
349 419 }
350 420  
  421 +
351 422 all_num += item.goods_num;
352 423 item.original_img = oo.imghost + item.original_img;
353 424 item.selected = 0;
... ... @@ -1373,7 +1444,7 @@ Page({
1373 1444 })
1374 1445 } else {
1375 1446 //--- 看一下是不是线下库存 ---
1376   - if(th.data.sales_rules==2){
  1447 + if(th.data.sales_rules==2 && goodsinfo.prom_type!=7){
1377 1448 th.check_down_line(t, pitem, item,wareIds);
1378 1449 }else{
1379 1450 if (t.goods_num > store_count) {
... ... @@ -1433,6 +1504,7 @@ Page({
1433 1504  
1434 1505 //---检验线下库存的数量的子函数---
1435 1506 async check_down_line_next(t, pitem, item,erpwareid,func){
  1507 +
1436 1508 var goodsinfo = this.data.requestData[pitem].goods[item];
1437 1509 var lock=0,pick_no,plist;
1438 1510 //先读取门店的lock
... ...
pages/cart/cart/cart.wxml
... ... @@ -88,12 +88,14 @@
88 88 <view class="abs flex-center fs26" wx:if="{{items.distr_type==2}}">物流</view>
89 89 </block>
90 90  
91   - <block wx:if="{{items.prom_type==7 && items.zhqty}}">
  91 + <block wx:if="{{items.prom_type==7}}">
92 92 <block wx:if="{{items.selected}}">
93   - <text wx:if="{{items.zhqty>items.goods_num}}" class="abs2">还需购买{{items.zhqty-items.goods_num}}件</text>
  93 + <!-- 主要显示限购 -->
  94 + <text wx:if="{{items.buyqty>0 && items.zh_b_num>0}}" class="abs2">活动剩余可购{{items.buyqty-items.zh_b_num>0?items.buyqty-items.zh_b_num:0}}件</text>
  95 + <text wx:elif="{{items.zhqty>items.goods_num}}" class="abs2">还需购买{{items.zhqty-items.goods_num}}件</text>
94 96 </block>
95 97 <block wx:else>
96   - <text class="abs2">需购买{{items.zhqty}}件</text>
  98 + <text wx:if="{{items.zhqty}}" class="abs2">需购买{{items.zhqty}}件</text>
97 99 </block>
98 100 </block>
99 101  
... ...
pages/cart/cart/zh_calculate.js
... ... @@ -58,7 +58,9 @@ module.exports = {
58 58 offline_price = 0,
59 59 offline_num = 0;
60 60 var txt = "requestData[" + a + "].need_list";
61   - if (!car_item.zh_map) {
  61 + //活动的列表都存储在这里面,可以快速查询
  62 + var zh_prom_goods=car_item.zh_prom_goods;
  63 + if (!car_item.zh_map && !zh_prom_goods) {
62 64 var res = {
63 65 tfeel: tfeel,
64 66 offline_price: offline_price,
... ... @@ -69,9 +71,7 @@ module.exports = {
69 71 });
70 72 return res;
71 73 }
72   -
73   - //活动的列表都存储在这里面,可以快速查询
74   - var zh_prom_goods=car_item.zh_prom_goods;
  74 +
75 75 //因为可能有多个组合购的活动
76 76 for (var i in car_item.zh_map) {
77 77 var bitem = car_item.zh_map[i];
... ... @@ -86,6 +86,11 @@ module.exports = {
86 86 var title =""; //提示语;
87 87 //var goods = bitem.goods;
88 88 var goods = zh_prom_goods[act.id];
  89 +
  90 + for (let v3 in car_item.goods) {
  91 + car_item.goods[v3].need_downlow_num=0;
  92 + }
  93 +
89 94 //寻找一下
90 95 function get_num(ite) {
91 96 for (let v1 in bitem.goods) {
... ... @@ -115,6 +120,7 @@ module.exports = {
115 120 var cart_num=get_num(item).goods_num;
116 121 var zh_b_num=get_num2(item).zh_b_num;
117 122  
  123 + item.cart_num =cart_num;
118 124 //-- 当商品有购买的时候,以及有限购的时候 --
119 125 if(zh_b_num>0 && item.buyqty>0){
120 126  
... ... @@ -139,13 +145,14 @@ module.exports = {
139 145 item.num =cart_num;
140 146 }
141 147  
142   -
143 148 item.goods_price=get_num(item).goods_price;
144 149 item.offline_price=get_num(item).offline_price;
145   -
  150 + if(item.cart_num){
  151 + all_price += item.cart_num * item.goods_price;
  152 + }
146 153 if (item.num) {
147 154 all_num += item.num;
148   - all_price += item.num * item.goods_price;
  155 +
149 156 //当有起购数的控制的时候
150 157 if (item.zhqty) {
151 158 all_zhqty += item.zhqty;
... ...
pages/cart/cart2/cart2.js
... ... @@ -940,8 +940,8 @@ Page({
940 940  
941 941 //计算价格
942 942 th.calculatePrice2();
943   - //获取优惠券
944   - th.get_buy_now_quan();
  943 + //获取优惠券,如果有券的钱,就调用
  944 + if(th.data.ckeck_quan_price>0) th.get_buy_now_quan();
945 945 }
946 946 });
947 947  
... ... @@ -1258,8 +1258,8 @@ Page({
1258 1258 if(item[j].prom_type!=7){
1259 1259 o_price_no_zh += item[j].goods_price * item[j].goods_num;
1260 1260 }
1261   - //组合购的商品,且没有订单优惠的叠加,is_orderyh就是优惠叠加
1262   - if(zh_prom_goods[item[j].prom_id] && !zh_prom_goods[item[j].prom_id].act.is_orderyh )
  1261 + //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加
  1262 + else if(zh_prom_goods && zh_prom_goods[item[j].prom_id] && zh_prom_goods[item[j].prom_id].act.is_orderyh )
1263 1263 {
1264 1264 o_price_no_zh += item[j].goods_price * item[j].goods_num;
1265 1265 }
... ... @@ -1273,7 +1273,7 @@ Page({
1273 1273 o_price_no_zh-=c_arr[i].cut_price;
1274 1274 }
1275 1275 //如果有组合购优惠的钱,就要减价
1276   - if (c_arr[i].zh_cut_price > 0){
  1276 + if (c_arr[i].zh_cut_price>0 || c_arr[i].zh_cut_price<0){
1277 1277 o_price -= c_arr[i].zh_cut_price;
1278 1278 if(o_price_no_zh>0){
1279 1279 //找到那些可以订单优惠叠加的
... ... @@ -2027,11 +2027,11 @@ Page({
2027 2027 }
2028 2028  
2029 2029 //--判断优惠活动的提交--
2030   - if (th.data.formData.cut_price > 0) {
  2030 + if (th.data.formData.cut_price > 0 ) {
2031 2031 order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2);
2032 2032 var ob = [{
2033 2033 "prom_id": th.data.bn_goods.prom_id,
2034   - "dis": th.data.formData.cut_price.toFixed(2),
  2034 + "dis": parseFloat(th.data.formData.cut_price).toFixed(2),
2035 2035 "ispt": 0
2036 2036 }]
2037 2037 order_prom_list.prom_pt_json = JSON.stringify(ob);
... ... @@ -2266,12 +2266,12 @@ Page({
2266 2266 order_prom_list.discount_amount =0;
2267 2267 //--判断优惠活动的提交--
2268 2268 if (t_item.cut_price > 0) {
2269   - order_prom_list.discount_amount += t_item.cut_price.toFixed(2);
  2269 + order_prom_list.discount_amount += t_item.cut_price;
2270 2270 order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json);
2271 2271 }
2272 2272 //--判断组合优惠活动的提交--
2273   - if (t_item.zh_cut_price > 0) {
2274   - order_prom_list.discount_amount += t_item.zh_cut_price.toFixed(2);
  2273 + if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) {
  2274 + order_prom_list.discount_amount += t_item.zh_cut_price;
2275 2275 order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json);
2276 2276 }
2277 2277 if (t_item.s_intValue > 0) {
... ... @@ -2285,8 +2285,14 @@ Page({
2285 2285 order_prom_list.give_lb_id = t_item.s_libao;
2286 2286 order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num);
2287 2287 }
2288   - if (Object.keys(order_prom_list).length > 0)
  2288 + if (Object.keys(order_prom_list).length > 0){
  2289 + if(order_prom_list.discount_amount)
  2290 + order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2);
  2291 + if(order_prom_list.order_prom_amount)
  2292 + order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2);
2289 2293 item.order_prom_list = order_prom_list;
  2294 + }
  2295 +
2290 2296  
2291 2297 //老会员成为分销下线需要的参数
2292 2298 if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) {
... ...
pages/cart/cart2/cart2.wxml
... ... @@ -428,7 +428,7 @@
428 428 <view class="co-red">- ¥ {{filters.toFix(formData.cut_price,2)}}元</view>
429 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 || formData.zh_cut_price<0}}">
432 432 <view>组合购优惠</view>
433 433 <view class="co-red">- ¥ {{filters.toFix(formData.zh_cut_price,2)}}元</view>
434 434 </view>
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -711,6 +711,11 @@ Page({
711 711 onShow: function() {
712 712 console.log('djfijsaoifjoisadjfoij');
713 713 var goods_list = null,th = this,that=this;
  714 + var show_prew_img= this.data.show_prew_img
  715 + if(show_prew_img){
  716 + show_prew_img=0;
  717 + return false;
  718 + }
714 719  
715 720 //优惠券要实时更新
716 721 getApp().getConfig2(function(e) {
... ... @@ -1303,10 +1308,10 @@ Page({
1303 1308 }else if(o.prom_type==7){
1304 1309  
1305 1310 //判断进行中的活动,是不是要判断线下库存
1306   - check_zh_acting(function (e) {
  1311 + th.check_zh_acting(function (ee){
1307 1312 newd.prom_id = 0;
1308 1313 newd.prom_type = 0;
1309   - if(e){
  1314 + if(ee){
1310 1315 newd.prom_id = th.data.zh_act.id;
1311 1316 newd.prom_type = 7;
1312 1317 if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
... ... @@ -2061,6 +2066,7 @@ Page({
2061 2066 for(var i in b){
2062 2067 b[i] = this.data.iurl + e[i];
2063 2068 }
  2069 + this.data.show_prew_img=1;
2064 2070  
2065 2071 wx.previewImage({
2066 2072 current: b[t.currentTarget.dataset.id],
... ... @@ -2074,6 +2080,7 @@ Page({
2074 2080 for (var i in b) {
2075 2081 b[i] = this.data.iurl + e[i];
2076 2082 }
  2083 + this.data.show_prew_img=1;
2077 2084 wx.previewImage({
2078 2085 current: b[t.currentTarget.dataset.id],
2079 2086 urls: b
... ... @@ -2089,6 +2096,7 @@ Page({
2089 2096 current: a[t.currentTarget.dataset.id],
2090 2097 urls: a
2091 2098 });
  2099 + this.data.show_prew_img=1;
2092 2100 },
2093 2101 closePromModal: function() {
2094 2102 this.setData({
... ... @@ -5388,6 +5396,7 @@ Page({
5388 5396 },
5389 5397  
5390 5398 previewImage() {
  5399 + this.data.show_prew_img=1;
5391 5400 wx.previewImage({
5392 5401 //将图片预览出来
5393 5402 urls: [this.data.shareImgPath]
... ...
utils/pay.js
... ... @@ -53,6 +53,7 @@ module.exports = {
53 53 },
54 54 weixinPay: function(n, e, a) {
55 55 if(!n) return false;
  56 + /*--
56 57 wx.requestPayment({
57 58 timeStamp: String(n.timeStamp),
58 59 nonceStr: n.nonceStr,
... ... @@ -67,6 +68,32 @@ module.exports = {
67 68 t.confirmBox("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)),
68 69 "function" == typeof a && a();
69 70 }
70   - });
  71 + });--*/
  72 +
  73 + wx.requestOrderPayment({
  74 + timeStamp: String(n.timeStamp),
  75 + nonceStr: n.nonceStr,
  76 + package: n.packageValue,
  77 + signType: n.signType,
  78 + paySign: n.paySign,
  79 + orderInfo: n.orderInfo, // 需要新增的 订单 信息
  80 + success (n) {
  81 + t.showSuccess("支付成功!", e);
  82 + },
  83 + fail (n) {
  84 + if(!n.errMsg ) {
  85 + getApp().showWarning("支付失败");
  86 + "function" == typeof fail && fail();
  87 + return false;
  88 + }
  89 +
  90 + console.log(n), "requestOrderPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestOrderPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") :
  91 + t.confirmBox("支付失败:" + n.errMsg.substr("requestOrderPayment:fail ".length)),
  92 + "function" == typeof a && a();
  93 + }
  94 + })
  95 +
  96 +
  97 +
71 98 }
72 99 };
73 100 \ No newline at end of file
... ...
utils/wxParse/wxParse.js
... ... @@ -15,9 +15,10 @@ function t(e, t, a) {
15 15  
16 16 function a(e) {
17 17 var t = this, a = e.target.dataset.src, i = e.target.dataset.from;
  18 + t.data.show_prew_img=1;
18 19 void 0 !== i && i.length > 0 && wx.previewImage({
19 20 current: a,
20   - urls: t.data[i].imageUrls
  21 + urls: t.data[i].imageUrls,
21 22 });
22 23 }
23 24  
... ...
utils/wxParse/wxParse.wxml
... ... @@ -377,7 +377,7 @@
377 377 </view>
378 378 </template>
379 379 <template name="wxParseImg">
380   - <image bindload="wxParseImgLoad" bindtap="wxParseImgTap" class="{{item.classStr}} wxParse-{{item.tag}}" data-from="{{item.from}}" data-idx="{{item.imgIndex}}" data-src="{{item.attr.src}}" mode="widthFix" src="{{item.attr.src}}" style="width:100%;"></image>
  380 + <image bindload="wxParseImgLoad" bindtap="wxParseImgTap" class="{{item.classStr}} wxParse-{{item.tag}}" data-from="{{item.from}}" data-idx="{{item.imgIndex}}" data-src="{{item.attr.src}}" mode="widthFix" src="{{item.attr.src}}" style="width:{{item.width}}px;max-width:100%;"></image>
381 381 </template>
382 382 <template name="wxParseVideo">
383 383 <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
... ...