Commit c7c0e2f2 by 高淑倩

plus会员差价

parent 9c1a5558
// pages/confirmOrder/confirmOrder.js
const wxService = require('../../utils/wxService')
const app = getApp()
const utils = require('../../utils/util')
wxService.page({
/**
......@@ -15,6 +16,9 @@ wxService.page({
trolleySku2Buy: Array,
currentOrderList: Array,
isSelect: false,
selectPrice:'',
noSelectPrice:'',
plusSpread:'',
goodsAddress: false,
citys: null,
cityView: '',
......@@ -308,6 +312,27 @@ wxService.page({
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
let skuList = data.tradePreviewSkus
let sum =0
skuList.forEach((item,index) => {
// item.price
sum += skuList[index].price
})
// 初始化商品价格
const { isSelect } = this.data
if(isSelect){
this.setData({
selectPrice: sum
})
} else {
this.setData({
noSelectPrice: sum
})
}
this.setData({
currentOrderList: data,
defalutCoupon: data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0].couponDiscount || '',
......
......@@ -115,7 +115,7 @@
<view class="plus-price" wx:if="{{isSelect}}">
<view class="plus-info">
<text class="price-label">plus会员价</text>
<text class="member-price">-¥20</text>
<text class="member-price">-¥{{utils.numberFormat(noSelectPrice - selectPrice)}}</text>
</view>
<text class="plus-member-price total-price">¥{{plusMemberPrice}}</text>
</view>
......
......@@ -294,6 +294,10 @@ const formatNumber = n => {
return n[1] ? n : '0' + n
}
function getSum(preValue,curValue,index, array) {
return preValue + curValue;
}
function _getUserInfo(ev) {
const userInfo = ev.detail || ev
return getUserInfoByBtn(userInfo).then((data = {}) => {
......@@ -351,6 +355,7 @@ wxService.setGetAuthUserInfo(_getUserInfo);
module.exports = {
_getUserInfo,
formatTime,
getSum,
getCurrentPageUrl,
getCurrentRouter,
getCurrentPageUrlWithArgs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment