Commit 0120230666e7df154e4256186053b7e01f037b8e

Authored by 泉州测试
1 parent 303f2df7

幸运 购 支付前 检查库存量

pages/user/order_detail/order_detail.js
... ... @@ -316,6 +316,27 @@ Page({
316 316  
317 317 //--------立即支付----------
318 318 async jumpToCart4(e) {
  319 +
  320 + // 幸运购检查库存量 api/weshop/activitylist/getActLen/{store_id}/{prom_type}/{prom_id}
  321 + if (parseInt(this.data.order.order_goods['0']['prom_type']) == 9) {
  322 + var aid = this.data.order.order_goods['0']['prom_id'];
  323 + var knum = 0;
  324 + await r.promiseGet('/api/weshop/activitylist/getActLen/' + os.stoid + '/9/' + aid, {
  325 + }).then(res => {
  326 + if (res.data.code == 0) {
  327 + knum = res.data.data;
  328 + }
  329 +
  330 + });
  331 +
  332 + if (knum <= 0) {
  333 + getApp().confirmBox("库存为0,支付失败");
  334 + return false;
  335 + }
  336 +
  337 + }
  338 +
  339 +
319 340 var th=this;
320 341 if(this.data.optionIsGoup)
321 342 wx.navigateTo({
... ...
pages/user/order_list/order_list.js
... ... @@ -484,6 +484,7 @@ Page({
484 484 },
485 485 /*----------跳转支付-----------*/
486 486 async jumpToCart4(t) {
  487 +
487 488 var o_index = t.currentTarget.dataset.idx;
488 489 var e = this.data.orderList[o_index];
489 490 var th = this;
... ... @@ -491,6 +492,26 @@ Page({
491 492 var order_goods = e.order_goods;
492 493 var user_id=getApp().globalData.userInfo.user_id;
493 494  
  495 + // 幸运购检查库存量 api/weshop/activitylist/getActLen/{store_id}/{prom_type}/{prom_id}
  496 + if (parseInt(order_goods['0']['prom_type']) == 9) {
  497 + var aid = order_goods['0']['prom_id'];
  498 + var knum = 0;
  499 + await r.promiseGet('/api/weshop/activitylist/getActLen/' + os.stoid + '/9/' + aid, {
  500 + }).then(res => {
  501 + if (res.data.code == 0) {
  502 + knum = res.data.data;
  503 + }
  504 +
  505 + });
  506 +
  507 + if (knum <= 0) {
  508 + getApp().confirmBox("库存为0,支付失败");
  509 + return false;
  510 + }
  511 +
  512 + }
  513 +
  514 +
494 515 var wlist = "";
495 516 for (var i in order_goods) {
496 517 var good = order_goods[i];
... ...