Commit 7d788d945b877feba49c9e6765d64c96dd655278
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
12 changed files
with
292 additions
and
90 deletions
packageB/pages/zuhegou/index/index.js
| @@ -472,34 +472,61 @@ Page({ | @@ -472,34 +472,61 @@ Page({ | ||
| 472 | var txt2 = "list[" + index + "].showNum"; | 472 | var txt2 = "list[" + index + "].showNum"; |
| 473 | th.data.sele_g = this.data.list[index]; | 473 | th.data.sele_g = this.data.list[index]; |
| 474 | 474 | ||
| 475 | - | ||
| 476 | wx.showModal({ | 475 | wx.showModal({ |
| 477 | title: '温馨提示', | 476 | title: '温馨提示', |
| 478 | - content: '确定将该商品移出购物车?', | 477 | + content: "确定取消该商品参与活动?", |
| 479 | success (res) { | 478 | success (res) { |
| 480 | if (res.confirm) { | 479 | if (res.confirm) { |
| 481 | console.log('用户点击确定'); | 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 | } else if (res.cancel) { | 530 | } else if (res.cancel) { |
| 504 | console.log('用户点击取消') | 531 | console.log('用户点击取消') |
| 505 | self.setData({ | 532 | self.setData({ |
| @@ -551,6 +578,7 @@ Page({ | @@ -551,6 +578,7 @@ Page({ | ||
| 551 | var index = e.currentTarget.dataset.index; | 578 | var index = e.currentTarget.dataset.index; |
| 552 | var item = this.data.list[index]; | 579 | var item = this.data.list[index]; |
| 553 | let num = item.num; | 580 | let num = item.num; |
| 581 | + th.data.s_cart_num = this.data.sele_g.cart_num - 1; | ||
| 554 | 582 | ||
| 555 | if (num >= 2) { | 583 | if (num >= 2) { |
| 556 | var check_num = num - 1; | 584 | var check_num = num - 1; |
| @@ -569,7 +597,7 @@ Page({ | @@ -569,7 +597,7 @@ Page({ | ||
| 569 | th.data.sele_g = item; | 597 | th.data.sele_g = item; |
| 570 | th.data.sele_index = index; | 598 | th.data.sele_index = index; |
| 571 | th.data.goodsInputNum = check_num; | 599 | th.data.goodsInputNum = check_num; |
| 572 | - th.data.s_cart_num = this.data.sele_g.cart_num - 1; | 600 | + |
| 573 | th.sub_updata_cart(); | 601 | th.sub_updata_cart(); |
| 574 | return false; | 602 | return false; |
| 575 | } | 603 | } |
| @@ -580,27 +608,54 @@ Page({ | @@ -580,27 +608,54 @@ Page({ | ||
| 580 | 608 | ||
| 581 | wx.showModal({ | 609 | wx.showModal({ |
| 582 | title: '温馨提示', | 610 | title: '温馨提示', |
| 583 | - content: '确定将该商品移出购物车?', | 611 | + content: '确定取消该商品参与活动?', |
| 584 | success (res) { | 612 | success (res) { |
| 585 | if (res.confirm) { | 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 | } else if (res.cancel) { | 660 | } else if (res.cancel) { |
| 606 | console.log('用户点击取消') | 661 | console.log('用户点击取消') |
| @@ -844,6 +899,10 @@ Page({ | @@ -844,6 +899,10 @@ Page({ | ||
| 844 | goods_sn: o.goods_sn, | 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 | if (th.data.c_guide_id) { | 907 | if (th.data.c_guide_id) { |
| 849 | newd['guide_id'] = th.data.c_guide_id; | 908 | newd['guide_id'] = th.data.c_guide_id; |
| @@ -951,6 +1010,12 @@ Page({ | @@ -951,6 +1010,12 @@ Page({ | ||
| 951 | }); | 1010 | }); |
| 952 | th.data.adding = 0; | 1011 | th.data.adding = 0; |
| 953 | th.data.sele_store = 1; | 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 | th.re_sum_price();//重新统计数量和总金额 | 1019 | th.re_sum_price();//重新统计数量和总金额 |
| 955 | } | 1020 | } |
| 956 | }); | 1021 | }); |
| @@ -1470,8 +1535,8 @@ Page({ | @@ -1470,8 +1535,8 @@ Page({ | ||
| 1470 | store_id: os.stoid, | 1535 | store_id: os.stoid, |
| 1471 | user_id: user_id, | 1536 | user_id: user_id, |
| 1472 | goods_id: gd.goods_id, | 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 | }).then(res2=>{ | 1541 | }).then(res2=>{ |
| 1477 | var g_buy_num=0; | 1542 | var g_buy_num=0; |
| @@ -1540,6 +1605,11 @@ Page({ | @@ -1540,6 +1605,11 @@ Page({ | ||
| 1540 | }); | 1605 | }); |
| 1541 | th.data.adding = 0; | 1606 | th.data.adding = 0; |
| 1542 | th.data.sele_store = 1; | 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 | th.re_sum_price();//重新统计数量和总金额 | 1613 | th.re_sum_price();//重新统计数量和总金额 |
| 1544 | } | 1614 | } |
| 1545 | }); | 1615 | }); |
| @@ -1594,7 +1664,7 @@ Page({ | @@ -1594,7 +1664,7 @@ Page({ | ||
| 1594 | if(check_obj.prom_buybum && check_obj.prom_buybum>0) prom_buybum=check_obj.prom_buybum; | 1664 | if(check_obj.prom_buybum && check_obj.prom_buybum>0) prom_buybum=check_obj.prom_buybum; |
| 1595 | 1665 | ||
| 1596 | if(check_obj){ | 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 | th.data.sele_g.buyqty>0 | 1668 | th.data.sele_g.buyqty>0 |
| 1599 | ){ | 1669 | ){ |
| 1600 | wx.showToast({ | 1670 | wx.showToast({ |
| @@ -1604,7 +1674,7 @@ Page({ | @@ -1604,7 +1674,7 @@ Page({ | ||
| 1604 | }); | 1674 | }); |
| 1605 | return false; | 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 | th.data.sele_g.viplimited>0 | 1678 | th.data.sele_g.viplimited>0 |
| 1609 | ){ | 1679 | ){ |
| 1610 | wx.showToast({ | 1680 | wx.showToast({ |
| @@ -1616,12 +1686,12 @@ Page({ | @@ -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 | var num=item.goods_num; | 1697 | var num=item.goods_num; |
| @@ -1637,17 +1707,12 @@ Page({ | @@ -1637,17 +1707,12 @@ Page({ | ||
| 1637 | [txt5]: item.goods_num, | 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 | var updata = { | 1710 | var updata = { |
| 1647 | id: item.id, | 1711 | id: item.id, |
| 1648 | prom_type: 7, | 1712 | prom_type: 7, |
| 1649 | goods_price: cur_price, | 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 | if (getApp().globalData.guide_id) { | 1717 | if (getApp().globalData.guide_id) { |
| 1653 | updata['guide_id'] = getApp().globalData.guide_id; | 1718 | updata['guide_id'] = getApp().globalData.guide_id; |
pages/activity/seckill_list/seckill_list.js
| @@ -17,9 +17,13 @@ Page({ | @@ -17,9 +17,13 @@ Page({ | ||
| 17 | 17 | ||
| 18 | //------初始化加载---------- | 18 | //------初始化加载---------- |
| 19 | onLoad: function(t) { | 19 | onLoad: function(t) { |
| 20 | - wx.setNavigationBarTitle({ title: "商品秒杀",}) | ||
| 21 | - | 20 | + wx.setNavigationBarTitle({ title: "商品秒杀",}) |
| 22 | var first_leader = t.first_leader; | 21 | var first_leader = t.first_leader; |
| 22 | + var type=t.type; | ||
| 23 | + if(type!=undefined){ | ||
| 24 | + this.setData({type:type}); | ||
| 25 | + } | ||
| 26 | + | ||
| 23 | var th=this; | 27 | var th=this; |
| 24 | 28 | ||
| 25 | console.log("------------"); | 29 | console.log("------------"); |
| @@ -129,8 +133,17 @@ Page({ | @@ -129,8 +133,17 @@ Page({ | ||
| 129 | }); | 133 | }); |
| 130 | 134 | ||
| 131 | if(plist.length<=0){ | 135 | if(plist.length<=0){ |
| 136 | + | ||
| 132 | getApp().showWarning("没有更多数据"); | 137 | getApp().showWarning("没有更多数据"); |
| 133 | th.data.ismore=0; | 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,7 +160,7 @@ Page({ | ||
| 147 | alllist.push(plist[i]); | 160 | alllist.push(plist[i]); |
| 148 | } | 161 | } |
| 149 | e.data.currentPage++; | 162 | e.data.currentPage++; |
| 150 | - console.log("秒杀商品列表", alllist); | 163 | + console.log("秒杀商品列表", alllist); |
| 151 | th.setData({goodlist:alllist,isshow:1}); | 164 | th.setData({goodlist:alllist,isshow:1}); |
| 152 | 165 | ||
| 153 | }, | 166 | }, |
pages/activity/seckill_list/seckill_list.wxml
| @@ -84,11 +84,11 @@ | @@ -84,11 +84,11 @@ | ||
| 84 | <view class="theader" > | 84 | <view class="theader" > |
| 85 | <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> | 85 | <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> |
| 86 | <image class="xc-bottom" | 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 | 火热进行中</view> | 88 | 火热进行中</view> |
| 89 | <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> | 89 | <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> |
| 90 | <image class="xc-bottom" | 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 | 即将开始</view> | 92 | 即将开始</view> |
| 93 | </view> | 93 | </view> |
| 94 | </view> | 94 | </view> |
pages/cart/cart/cart.js
| @@ -198,6 +198,7 @@ Page({ | @@ -198,6 +198,7 @@ Page({ | ||
| 198 | get_cart: function() { | 198 | get_cart: function() { |
| 199 | var th = this; | 199 | var th = this; |
| 200 | var rd = Math.random().toString(36).substr(2, 15); | 200 | var rd = Math.random().toString(36).substr(2, 15); |
| 201 | + var user_id=getApp().globalData.userInfo.user_id; | ||
| 201 | getApp().request.get("/api/weshop/cart/list", { | 202 | getApp().request.get("/api/weshop/cart/list", { |
| 202 | data: { | 203 | data: { |
| 203 | user_id: app.globalData.user_id, | 204 | user_id: app.globalData.user_id, |
| @@ -249,6 +250,40 @@ Page({ | @@ -249,6 +250,40 @@ Page({ | ||
| 249 | //商品已经下架 | 250 | //商品已经下架 |
| 250 | continue; | 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 | if (item.prom_type == 1) { | 289 | if (item.prom_type == 1) { |
| @@ -266,6 +301,22 @@ Page({ | @@ -266,6 +301,22 @@ Page({ | ||
| 266 | //商品已经下架 | 301 | //商品已经下架 |
| 267 | continue; | 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 | else if (item.prom_type == 3) { | 322 | else if (item.prom_type == 3) { |
| @@ -330,6 +381,25 @@ Page({ | @@ -330,6 +381,25 @@ Page({ | ||
| 330 | getApp().request.delete(url, {}); | 381 | getApp().request.delete(url, {}); |
| 331 | continue; | 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 | else if(item.prom_type == 0) { | 404 | else if(item.prom_type == 0) { |
| 335 | //如果有优惠活动,要更新活动 | 405 | //如果有优惠活动,要更新活动 |
| @@ -348,6 +418,7 @@ Page({ | @@ -348,6 +418,7 @@ Page({ | ||
| 348 | }) | 418 | }) |
| 349 | } | 419 | } |
| 350 | 420 | ||
| 421 | + | ||
| 351 | all_num += item.goods_num; | 422 | all_num += item.goods_num; |
| 352 | item.original_img = oo.imghost + item.original_img; | 423 | item.original_img = oo.imghost + item.original_img; |
| 353 | item.selected = 0; | 424 | item.selected = 0; |
| @@ -1373,7 +1444,7 @@ Page({ | @@ -1373,7 +1444,7 @@ Page({ | ||
| 1373 | }) | 1444 | }) |
| 1374 | } else { | 1445 | } else { |
| 1375 | //--- 看一下是不是线下库存 --- | 1446 | //--- 看一下是不是线下库存 --- |
| 1376 | - if(th.data.sales_rules==2){ | 1447 | + if(th.data.sales_rules==2 && goodsinfo.prom_type!=7){ |
| 1377 | th.check_down_line(t, pitem, item,wareIds); | 1448 | th.check_down_line(t, pitem, item,wareIds); |
| 1378 | }else{ | 1449 | }else{ |
| 1379 | if (t.goods_num > store_count) { | 1450 | if (t.goods_num > store_count) { |
| @@ -1433,6 +1504,7 @@ Page({ | @@ -1433,6 +1504,7 @@ Page({ | ||
| 1433 | 1504 | ||
| 1434 | //---检验线下库存的数量的子函数--- | 1505 | //---检验线下库存的数量的子函数--- |
| 1435 | async check_down_line_next(t, pitem, item,erpwareid,func){ | 1506 | async check_down_line_next(t, pitem, item,erpwareid,func){ |
| 1507 | + | ||
| 1436 | var goodsinfo = this.data.requestData[pitem].goods[item]; | 1508 | var goodsinfo = this.data.requestData[pitem].goods[item]; |
| 1437 | var lock=0,pick_no,plist; | 1509 | var lock=0,pick_no,plist; |
| 1438 | //先读取门店的lock | 1510 | //先读取门店的lock |
pages/cart/cart/cart.wxml
| @@ -88,12 +88,14 @@ | @@ -88,12 +88,14 @@ | ||
| 88 | <view class="abs flex-center fs26" wx:if="{{items.distr_type==2}}">物流</view> | 88 | <view class="abs flex-center fs26" wx:if="{{items.distr_type==2}}">物流</view> |
| 89 | </block> | 89 | </block> |
| 90 | 90 | ||
| 91 | - <block wx:if="{{items.prom_type==7 && items.zhqty}}"> | 91 | + <block wx:if="{{items.prom_type==7}}"> |
| 92 | <block wx:if="{{items.selected}}"> | 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 | </block> | 96 | </block> |
| 95 | <block wx:else> | 97 | <block wx:else> |
| 96 | - <text class="abs2">需购买{{items.zhqty}}件</text> | 98 | + <text wx:if="{{items.zhqty}}" class="abs2">需购买{{items.zhqty}}件</text> |
| 97 | </block> | 99 | </block> |
| 98 | </block> | 100 | </block> |
| 99 | 101 |
pages/cart/cart/zh_calculate.js
| @@ -58,7 +58,9 @@ module.exports = { | @@ -58,7 +58,9 @@ module.exports = { | ||
| 58 | offline_price = 0, | 58 | offline_price = 0, |
| 59 | offline_num = 0; | 59 | offline_num = 0; |
| 60 | var txt = "requestData[" + a + "].need_list"; | 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 | var res = { | 64 | var res = { |
| 63 | tfeel: tfeel, | 65 | tfeel: tfeel, |
| 64 | offline_price: offline_price, | 66 | offline_price: offline_price, |
| @@ -69,9 +71,7 @@ module.exports = { | @@ -69,9 +71,7 @@ module.exports = { | ||
| 69 | }); | 71 | }); |
| 70 | return res; | 72 | return res; |
| 71 | } | 73 | } |
| 72 | - | ||
| 73 | - //活动的列表都存储在这里面,可以快速查询 | ||
| 74 | - var zh_prom_goods=car_item.zh_prom_goods; | 74 | + |
| 75 | //因为可能有多个组合购的活动 | 75 | //因为可能有多个组合购的活动 |
| 76 | for (var i in car_item.zh_map) { | 76 | for (var i in car_item.zh_map) { |
| 77 | var bitem = car_item.zh_map[i]; | 77 | var bitem = car_item.zh_map[i]; |
| @@ -86,6 +86,11 @@ module.exports = { | @@ -86,6 +86,11 @@ module.exports = { | ||
| 86 | var title =""; //提示语; | 86 | var title =""; //提示语; |
| 87 | //var goods = bitem.goods; | 87 | //var goods = bitem.goods; |
| 88 | var goods = zh_prom_goods[act.id]; | 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 | function get_num(ite) { | 95 | function get_num(ite) { |
| 91 | for (let v1 in bitem.goods) { | 96 | for (let v1 in bitem.goods) { |
| @@ -115,6 +120,7 @@ module.exports = { | @@ -115,6 +120,7 @@ module.exports = { | ||
| 115 | var cart_num=get_num(item).goods_num; | 120 | var cart_num=get_num(item).goods_num; |
| 116 | var zh_b_num=get_num2(item).zh_b_num; | 121 | var zh_b_num=get_num2(item).zh_b_num; |
| 117 | 122 | ||
| 123 | + item.cart_num =cart_num; | ||
| 118 | //-- 当商品有购买的时候,以及有限购的时候 -- | 124 | //-- 当商品有购买的时候,以及有限购的时候 -- |
| 119 | if(zh_b_num>0 && item.buyqty>0){ | 125 | if(zh_b_num>0 && item.buyqty>0){ |
| 120 | 126 | ||
| @@ -139,13 +145,14 @@ module.exports = { | @@ -139,13 +145,14 @@ module.exports = { | ||
| 139 | item.num =cart_num; | 145 | item.num =cart_num; |
| 140 | } | 146 | } |
| 141 | 147 | ||
| 142 | - | ||
| 143 | item.goods_price=get_num(item).goods_price; | 148 | item.goods_price=get_num(item).goods_price; |
| 144 | item.offline_price=get_num(item).offline_price; | 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 | if (item.num) { | 153 | if (item.num) { |
| 147 | all_num += item.num; | 154 | all_num += item.num; |
| 148 | - all_price += item.num * item.goods_price; | 155 | + |
| 149 | //当有起购数的控制的时候 | 156 | //当有起购数的控制的时候 |
| 150 | if (item.zhqty) { | 157 | if (item.zhqty) { |
| 151 | all_zhqty += item.zhqty; | 158 | all_zhqty += item.zhqty; |
pages/cart/cart2/cart2.js
| @@ -940,8 +940,8 @@ Page({ | @@ -940,8 +940,8 @@ Page({ | ||
| 940 | 940 | ||
| 941 | //计算价格 | 941 | //计算价格 |
| 942 | th.calculatePrice2(); | 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,8 +1258,8 @@ Page({ | ||
| 1258 | if(item[j].prom_type!=7){ | 1258 | if(item[j].prom_type!=7){ |
| 1259 | o_price_no_zh += item[j].goods_price * item[j].goods_num; | 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 | o_price_no_zh += item[j].goods_price * item[j].goods_num; | 1264 | o_price_no_zh += item[j].goods_price * item[j].goods_num; |
| 1265 | } | 1265 | } |
| @@ -1273,7 +1273,7 @@ Page({ | @@ -1273,7 +1273,7 @@ Page({ | ||
| 1273 | o_price_no_zh-=c_arr[i].cut_price; | 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 | o_price -= c_arr[i].zh_cut_price; | 1277 | o_price -= c_arr[i].zh_cut_price; |
| 1278 | if(o_price_no_zh>0){ | 1278 | if(o_price_no_zh>0){ |
| 1279 | //找到那些可以订单优惠叠加的 | 1279 | //找到那些可以订单优惠叠加的 |
| @@ -2027,11 +2027,11 @@ Page({ | @@ -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 | order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); | 2031 | order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); |
| 2032 | var ob = [{ | 2032 | var ob = [{ |
| 2033 | "prom_id": th.data.bn_goods.prom_id, | 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 | "ispt": 0 | 2035 | "ispt": 0 |
| 2036 | }] | 2036 | }] |
| 2037 | order_prom_list.prom_pt_json = JSON.stringify(ob); | 2037 | order_prom_list.prom_pt_json = JSON.stringify(ob); |
| @@ -2266,12 +2266,12 @@ Page({ | @@ -2266,12 +2266,12 @@ Page({ | ||
| 2266 | order_prom_list.discount_amount =0; | 2266 | order_prom_list.discount_amount =0; |
| 2267 | //--判断优惠活动的提交-- | 2267 | //--判断优惠活动的提交-- |
| 2268 | if (t_item.cut_price > 0) { | 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 | order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); | 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 | order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); | 2275 | order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); |
| 2276 | } | 2276 | } |
| 2277 | if (t_item.s_intValue > 0) { | 2277 | if (t_item.s_intValue > 0) { |
| @@ -2285,8 +2285,14 @@ Page({ | @@ -2285,8 +2285,14 @@ Page({ | ||
| 2285 | order_prom_list.give_lb_id = t_item.s_libao; | 2285 | order_prom_list.give_lb_id = t_item.s_libao; |
| 2286 | order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); | 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 | item.order_prom_list = order_prom_list; | 2293 | item.order_prom_list = order_prom_list; |
| 2294 | + } | ||
| 2295 | + | ||
| 2290 | 2296 | ||
| 2291 | //老会员成为分销下线需要的参数 | 2297 | //老会员成为分销下线需要的参数 |
| 2292 | if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { | 2298 | if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { |
pages/cart/cart2/cart2.wxml
| @@ -428,7 +428,7 @@ | @@ -428,7 +428,7 @@ | ||
| 428 | <view class="co-red">- ¥ {{filters.toFix(formData.cut_price,2)}}元</view> | 428 | <view class="co-red">- ¥ {{filters.toFix(formData.cut_price,2)}}元</view> |
| 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 || 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> |
pages/goods/goodsInfo/goodsInfo.js
| @@ -711,6 +711,11 @@ Page({ | @@ -711,6 +711,11 @@ Page({ | ||
| 711 | onShow: function() { | 711 | onShow: function() { |
| 712 | console.log('djfijsaoifjoisadjfoij'); | 712 | console.log('djfijsaoifjoisadjfoij'); |
| 713 | var goods_list = null,th = this,that=this; | 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 | getApp().getConfig2(function(e) { | 721 | getApp().getConfig2(function(e) { |
| @@ -1303,10 +1308,10 @@ Page({ | @@ -1303,10 +1308,10 @@ Page({ | ||
| 1303 | }else if(o.prom_type==7){ | 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 | newd.prom_id = 0; | 1312 | newd.prom_id = 0; |
| 1308 | newd.prom_type = 0; | 1313 | newd.prom_type = 0; |
| 1309 | - if(e){ | 1314 | + if(ee){ |
| 1310 | newd.prom_id = th.data.zh_act.id; | 1315 | newd.prom_id = th.data.zh_act.id; |
| 1311 | newd.prom_type = 7; | 1316 | newd.prom_type = 7; |
| 1312 | if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); | 1317 | if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); |
| @@ -2061,6 +2066,7 @@ Page({ | @@ -2061,6 +2066,7 @@ Page({ | ||
| 2061 | for(var i in b){ | 2066 | for(var i in b){ |
| 2062 | b[i] = this.data.iurl + e[i]; | 2067 | b[i] = this.data.iurl + e[i]; |
| 2063 | } | 2068 | } |
| 2069 | + this.data.show_prew_img=1; | ||
| 2064 | 2070 | ||
| 2065 | wx.previewImage({ | 2071 | wx.previewImage({ |
| 2066 | current: b[t.currentTarget.dataset.id], | 2072 | current: b[t.currentTarget.dataset.id], |
| @@ -2074,6 +2080,7 @@ Page({ | @@ -2074,6 +2080,7 @@ Page({ | ||
| 2074 | for (var i in b) { | 2080 | for (var i in b) { |
| 2075 | b[i] = this.data.iurl + e[i]; | 2081 | b[i] = this.data.iurl + e[i]; |
| 2076 | } | 2082 | } |
| 2083 | + this.data.show_prew_img=1; | ||
| 2077 | wx.previewImage({ | 2084 | wx.previewImage({ |
| 2078 | current: b[t.currentTarget.dataset.id], | 2085 | current: b[t.currentTarget.dataset.id], |
| 2079 | urls: b | 2086 | urls: b |
| @@ -2089,6 +2096,7 @@ Page({ | @@ -2089,6 +2096,7 @@ Page({ | ||
| 2089 | current: a[t.currentTarget.dataset.id], | 2096 | current: a[t.currentTarget.dataset.id], |
| 2090 | urls: a | 2097 | urls: a |
| 2091 | }); | 2098 | }); |
| 2099 | + this.data.show_prew_img=1; | ||
| 2092 | }, | 2100 | }, |
| 2093 | closePromModal: function() { | 2101 | closePromModal: function() { |
| 2094 | this.setData({ | 2102 | this.setData({ |
| @@ -5388,6 +5396,7 @@ Page({ | @@ -5388,6 +5396,7 @@ Page({ | ||
| 5388 | }, | 5396 | }, |
| 5389 | 5397 | ||
| 5390 | previewImage() { | 5398 | previewImage() { |
| 5399 | + this.data.show_prew_img=1; | ||
| 5391 | wx.previewImage({ | 5400 | wx.previewImage({ |
| 5392 | //将图片预览出来 | 5401 | //将图片预览出来 |
| 5393 | urls: [this.data.shareImgPath] | 5402 | urls: [this.data.shareImgPath] |
utils/pay.js
| @@ -53,6 +53,7 @@ module.exports = { | @@ -53,6 +53,7 @@ module.exports = { | ||
| 53 | }, | 53 | }, |
| 54 | weixinPay: function(n, e, a) { | 54 | weixinPay: function(n, e, a) { |
| 55 | if(!n) return false; | 55 | if(!n) return false; |
| 56 | + /*-- | ||
| 56 | wx.requestPayment({ | 57 | wx.requestPayment({ |
| 57 | timeStamp: String(n.timeStamp), | 58 | timeStamp: String(n.timeStamp), |
| 58 | nonceStr: n.nonceStr, | 59 | nonceStr: n.nonceStr, |
| @@ -67,6 +68,32 @@ module.exports = { | @@ -67,6 +68,32 @@ module.exports = { | ||
| 67 | t.confirmBox("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), | 68 | t.confirmBox("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), |
| 68 | "function" == typeof a && a(); | 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 | \ No newline at end of file | 100 | \ No newline at end of file |
utils/wxParse/wxParse.js
| @@ -15,9 +15,10 @@ function t(e, t, a) { | @@ -15,9 +15,10 @@ function t(e, t, a) { | ||
| 15 | 15 | ||
| 16 | function a(e) { | 16 | function a(e) { |
| 17 | var t = this, a = e.target.dataset.src, i = e.target.dataset.from; | 17 | var t = this, a = e.target.dataset.src, i = e.target.dataset.from; |
| 18 | + t.data.show_prew_img=1; | ||
| 18 | void 0 !== i && i.length > 0 && wx.previewImage({ | 19 | void 0 !== i && i.length > 0 && wx.previewImage({ |
| 19 | current: a, | 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,7 +377,7 @@ | ||
| 377 | </view> | 377 | </view> |
| 378 | </template> | 378 | </template> |
| 379 | <template name="wxParseImg"> | 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 | </template> | 381 | </template> |
| 382 | <template name="wxParseVideo"> | 382 | <template name="wxParseVideo"> |
| 383 | <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | 383 | <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> |