【修复】移动端小程序/APP使用积分抵扣价格显示错误

admin 发布于 BUG提交 2021-12-29 23:52:02

ShopWind多商户电商系统有完整的积分体系,用户可以通过开店、购物、签到等途径获得积分。在下单购物的过程中积分可以根据平台后台设置的比例抵扣相应的货款。平台有独立的积分商城频道页面,商家在发布商品的时候可以设置商品可用于抵扣的积分数量,支持全部积分、积分+现金两种抵扣方式。设置好后商品会展示在积分商城频道中。
会员购物时候在同时使用优惠券、积分、满减等多种优惠方式的复杂运算中,价格显示如有以下错误,需要做以下的修复。

attachmentId-196

修改代码如下:

1、打开pages\order\normal.js 文件 在buildMoney(that)函数中修复以下判断条件

// 积分抵扣
if (that.form.exchange_integral > 0) {
  total -= that.integralExchange.money
}

修改为

// 积分抵扣
if (that.form.exchange_integral > 0) {
  let tmptotal = total - that.integralExchange.money
  if(tmptotal < 0) {
    that.integralExchange.money = total
    that.form.exchange_integral = total / that.orders.integralExchange.rate
    tmptotal = 0
  }
  total = tmptotal
}

2、打开pages\order\normal.js 文件 在切换优惠券coupon(that, store_id)函数中,由于订单金额发生改变,需重置积分选择增加defintegral(that)函数。

/**
 * 切换优惠券
 * @param {Object} that
 * @param {Object} store_id
 */
function coupon(that, store_id) {
  let options = []
  let list = that.orders.orderList[store_id].coupon_list
  for (let index in list) {
    if (index < 5) { // 该组件最多允许6个
      options.push(list[index].coupon_name + ' -' + currency(list[index].coupon_value))
    }
  }
  options.push("不使用优惠券")
  uni.showActionSheet({
    itemList: options,
    success: function(res) {
      that.form.coupon_sn[store_id] = (res.tapIndex == list.length || (res.tapIndex == 5)) ? 0 : list[res.tapIndex].coupon_sn
      // 有可能因为选择不使用优惠券后导致积分抵扣数有误,所以重置选择积分
      defintegral(that)
      buildMoney(that)
    }
  })
}
最后编辑于 2023-03-27 14:17:11
0 728
Re :

admin 这家伙什么都没留下

  • 回答

    97
  • 发布

    86
  • 经验

    6430

内容精选

联系我们

  • 微信官网

    关注公众号

    系统更新,推送提醒
  • 开发交流群

    技术交流Q群

    安装使用,开发交流

垂询热线:18978189162