Commit 3622c1354f49ed083f24cd00a4c08aa50e98460d
1 parent
a6a9ca33
我的订单预存支付效验
Showing
2 changed files
with
49 additions
and
4 deletions
pages/cart/cart/cart.js
| @@ -4367,10 +4367,10 @@ Page({ | @@ -4367,10 +4367,10 @@ Page({ | ||
| 4367 | if (!user_id) user_id = 0; | 4367 | if (!user_id) user_id = 0; |
| 4368 | var gd = e.currentTarget.dataset.gd; | 4368 | var gd = e.currentTarget.dataset.gd; |
| 4369 | var item2 = e.currentTarget.dataset.item; | 4369 | var item2 = e.currentTarget.dataset.item; |
| 4370 | - | 4370 | + |
| 4371 | var good_url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gd; | 4371 | var good_url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gd; |
| 4372 | 4372 | ||
| 4373 | - if(item2.prom_type>0){ | 4373 | + if(item2 && item2.prom_type>0){ |
| 4374 | good_url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gd + "&prom_id=" + item2.prom_id + "&prom_type="+item2.prom_type; | 4374 | good_url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gd + "&prom_id=" + item2.prom_id + "&prom_type="+item2.prom_type; |
| 4375 | getApp().goto(good_url); | 4375 | getApp().goto(good_url); |
| 4376 | return false; | 4376 | return false; |
pages/user/order_list/order_list.js
| @@ -598,6 +598,32 @@ Page({ | @@ -598,6 +598,32 @@ Page({ | ||
| 598 | } | 598 | } |
| 599 | }); | 599 | }); |
| 600 | }, | 600 | }, |
| 601 | + //预存款判断 | ||
| 602 | + async vipadvancesum(keyid,pre_cut,pre_json){ | ||
| 603 | + let pre=JSON.parse(pre_json) | ||
| 604 | + let listform=[] | ||
| 605 | + pre.map(item=>{ | ||
| 606 | + let obj={ | ||
| 607 | + advancesum: item.advancesum, | ||
| 608 | + advanceitemid: item.advanceitemid | ||
| 609 | + } | ||
| 610 | + listform.push(obj) | ||
| 611 | + }) | ||
| 612 | + let res = await getApp().request.promisePost(`/api/weshop/delphiapi/saveErpApi`, { | ||
| 613 | + data: { | ||
| 614 | + accdb: getApp().globalData.config.erpid, | ||
| 615 | + ApiName: 'api.pos.shop.vipadvancesum.list', | ||
| 616 | + // usercode: "admin", | ||
| 617 | + vipid: getApp().globalData.userInfo.erpvipid, | ||
| 618 | + // oddsum: "0", | ||
| 619 | + // advancesum: cartList.order_amount, | ||
| 620 | + storageid: keyid, | ||
| 621 | + listform | ||
| 622 | + }, | ||
| 623 | + is_json: 1 | ||
| 624 | + }) | ||
| 625 | + return res.data | ||
| 626 | + }, | ||
| 601 | /*----------跳转支付-----------*/ | 627 | /*----------跳转支付-----------*/ |
| 602 | async jumpToCart4(t) { | 628 | async jumpToCart4(t) { |
| 603 | 629 | ||
| @@ -613,6 +639,20 @@ Page({ | @@ -613,6 +639,20 @@ Page({ | ||
| 613 | var order_goods = e.order_goods; | 639 | var order_goods = e.order_goods; |
| 614 | var user_id = getApp().globalData.userInfo.user_id; | 640 | var user_id = getApp().globalData.userInfo.user_id; |
| 615 | 641 | ||
| 642 | + //如果使用预存的话,要重新效验下预存金额是否足够 | ||
| 643 | + if(order.pre_cut && order.pre_json){ | ||
| 644 | + let pickup_id=order.pickup_id | ||
| 645 | + let res = await r.promiseGet('/api/weshop/pickup/get/' + os.stoid + '/' + pickup_id, {}) | ||
| 646 | + let keyid = res.data.data.keyid | ||
| 647 | + let resdata = await th.vipadvancesum(keyid,order.pre_cut,order.pre_json) | ||
| 648 | + if(resdata.code !=0){ | ||
| 649 | + let msg=resdata.msg || "预存金额不足" | ||
| 650 | + getApp().confirmBox(msg); | ||
| 651 | + th.setData({ paying: 0 }); | ||
| 652 | + return false; | ||
| 653 | + } | ||
| 654 | + } | ||
| 655 | + | ||
| 616 | // 幸运购检查库存量 api/weshop/activitylist/getActLen/{store_id}/{prom_type}/{prom_id} | 656 | // 幸运购检查库存量 api/weshop/activitylist/getActLen/{store_id}/{prom_type}/{prom_id} |
| 617 | if (parseInt(order_goods['0']['prom_type']) == 9) { | 657 | if (parseInt(order_goods['0']['prom_type']) == 9) { |
| 618 | var aid = order_goods['0']['prom_id']; | 658 | var aid = order_goods['0']['prom_id']; |
| @@ -818,14 +858,18 @@ Page({ | @@ -818,14 +858,18 @@ Page({ | ||
| 818 | if (res.data.code == 0 && res.data.data && res.data.data.length) { | 858 | if (res.data.code == 0 && res.data.data && res.data.data.length) { |
| 819 | for (let i in res.data.data) { | 859 | for (let i in res.data.data) { |
| 820 | let item = res.data.data[i]; | 860 | let item = res.data.data[i]; |
| 821 | - if (item.prom_type == 3) { | 861 | + if (item.prom_type == 3 || item.prom_type==5) { |
| 822 | is_g_prom = 1; break; | 862 | is_g_prom = 1; break; |
| 823 | } | 863 | } |
| 824 | } | 864 | } |
| 825 | } | 865 | } |
| 826 | }) | 866 | }) |
| 867 | + | ||
| 827 | if (is_g_prom) { | 868 | if (is_g_prom) { |
| 828 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => { | 869 | + |
| 870 | + // await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => { | ||
| 871 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + good.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => { | ||
| 872 | + | ||
| 829 | if (res.data.code == 0) { | 873 | if (res.data.code == 0) { |
| 830 | var r_data = res.data.data; | 874 | var r_data = res.data.data; |
| 831 | if (!r_data.collocationPromList && good.prom_type == 5) { | 875 | if (!r_data.collocationPromList && good.prom_type == 5) { |
| @@ -848,6 +892,7 @@ Page({ | @@ -848,6 +892,7 @@ Page({ | ||
| 848 | } | 892 | } |
| 849 | }) | 893 | }) |
| 850 | } else { | 894 | } else { |
| 895 | + //只读优化促销和阶梯促销 | ||
| 851 | await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + good.goods_id, {}).then(res => { | 896 | await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + good.goods_id, {}).then(res => { |
| 852 | if (res.data.code == 0) { | 897 | if (res.data.code == 0) { |
| 853 | var r_data = res.data.data; | 898 | var r_data = res.data.data; |