Commit 796ba9a3 by 高淑倩

add: 订单详情

parent 92017a17
var utils = require('../../wxs/utils.wxs')
function hanlderIntegralPrice (product) {
var integarlGoods, singleGoods, maxIntegarlPrice, minPrice, maxPrice, prices, minIntegarlPrice
integarlGoods = product.exchange_credits > 0
singleGoods = product.minSkuPrice === product.maxSkuPrice
minPrice = utils.numberFormat((product.minSkuPrice) / 100) || 0
maxPrice = utils.numberFormat((product.maxSkuPrice) / 100) || 0
prices = ''
if (integarlGoods) {
minIntegarlPrice = utils.numberFormat((product.exchange_credits * product.integral_role) / 100 - product.minSkuPrice / 100) || 0
maxIntegarlPrice = utils.numberFormat((product.exchange_credits * product.integral_role) / 100 - product.maxSkuPrice / 100) || 0
prices = minIntegarlPrice * 1 < 0 ? (product.exchange_credits + '积分+¥' + Math.abs(minIntegarlPrice)) : (product.exchange_credits + '积分')
} else if (singleGoods && !integarlGoods) {
prices = maxPrice
} else {
prices = ['¥', minPrice, '-', maxPrice].join('')
}
return prices
}
module.exports = {
hanlderIntegralPrice: hanlderIntegralPrice
}
...@@ -9,12 +9,15 @@ Component({ ...@@ -9,12 +9,15 @@ Component({
properties: { properties: {
// 这里定义了属性,属性值可以在组件使用时指定 // 这里定义了属性,属性值可以在组件使用时指定
tableThemes: { tableThemes: {
type: Object, // 因此处的thead是json格式,故将数据类型设置为object type: Object,// 因此处的thead是json格式,故将数据类型设置为object
value: {}
}, },
tableItems: { tableItems: {
type: Array, type: Array,
value: []
} }
}, },
attached () {},
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
......
<!--components/table/table.wxml--> <!--components/table/table.wxml-->
<wxs src="../../wxs/utils.wxs" module="utils" />
<wxs src="./handler.wxs" module="tools" />
<view class='table'> <view class='table'>
<view class="thead"> <view class="thead">
<view class='tr'> <view class='tr'>
...@@ -6,8 +9,10 @@ ...@@ -6,8 +9,10 @@
</view> </view>
</view> </view>
<view class="tbody"> <view class="tbody">
<view class="tr" wx:for="{{tableItems}}" wx:key="{{index}}"> <view class="tr" wx:for="{{tableItems}}" wx:for-item="item" wx:for-index="k" wx:key="{{k}}" >
<view class="td" wx:for="{{item}}" wx:key="{{index}}">{{item}}</view> <view class="td">{{item.productCount}}</view>
<view class="td">{{item.productName}}</view>
<view class="td">{{utils.numberFormat(item.productMoney / 100)}}</view>
</view> </view>
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -12,7 +12,7 @@ wxService.page({ ...@@ -12,7 +12,7 @@ wxService.page({
no: '112222', no: '112222',
time: '2019-01-01', time: '2019-01-01',
store: '1231', store: '1231',
total: 25, totalNum: 0,
orderTotal: 50, orderTotal: 50,
paymentTotal: 48, paymentTotal: 48,
pointsTotal: 2, pointsTotal: 2,
...@@ -23,7 +23,7 @@ wxService.page({ ...@@ -23,7 +23,7 @@ wxService.page({
{ count: 2, name: '榛果', price: 5222 }, { count: 2, name: '榛果', price: 5222 },
{ count: 2, name: '薯片', price: 124 }, { count: 2, name: '薯片', price: 124 },
], ],
orderDetail: {}
}, },
/** /**
...@@ -46,10 +46,26 @@ wxService.page({ ...@@ -46,10 +46,26 @@ wxService.page({
}, },
initOrderDetail(orderNo){ initOrderDetail(orderNo){
wx.showLoading({
title: '加载中'
})
wxService.get(`/sale/order/findByOrderNo?orderNo=${orderNo}&brandId=1001`).then(res => { wxService.get(`/sale/order/findByOrderNo?orderNo=${orderNo}&brandId=1001`).then(res => {
this.setData({ const {result,data} = res.data
orderDetail:res.data.ddat.content if(result == 0){
}) wx.hideLoading()
// 数量
let countArr = []
data.productInfo.forEach(item=>{
countArr.push(item.productCount)
})
let countTotal = countArr.reduce((prev,cur)=>{
return prev + cur ;
})
this.setData({
orderDetail: data,
totalNum: countTotal
})
}
}).finally(() => { }).finally(() => {
}) })
......
<!--pages/consumptionDetails.wxml--> <!--pages/consumptionDetails.wxml-->
<wxs src="../../wxs/utils.wxs" module="utils" />
<view class="consumption"> <view class="consumption">
<view class="consumption-top"> <view class="consumption-top">
<view class="top-ract"></view> <view class="top-ract" />
<view class="top-order"> <view class="top-order">
<view>订单编号:<span class="top-data">{{orderDetail.orderId}}</span></view> <view>订单编号:
<view>消费时间:<span class="top-data">{{orderDetail.payTime}}</span></view> <span class="top-data">{{orderDetail.orderNo}}</span>
<view>消费门店:<span class="top-data">{{orderDetail.storeName}}</span><span class="top-statsu">{{orderDetail.status}}</span></view> </view>
</view> <view>消费时间:
</view> <span class="top-data">{{orderDetail.payTime}}</span>
</view>
<view>消费门店:
<span class="top-data">{{orderDetail.storeName}}</span>
<span class="top-statsu">{{orderDetail.status}}</span>
</view>
</view>
</view>
<view class="consumption-table"> <view class="consumption-table">
<table tableThemes="{{themeArr}}" tableItems="{{itemArr}}"></table> <table tableThemes="{{themeArr}}" tableItems="{{orderDetail.productInfo}}" />
</view> </view>
<!-- <image class="consumption-img" src="./../../images/3x-28.png" mode="widthFix"/>--> <!-- <image class="consumption-img" src="./../../images/3x-28.png" mode="widthFix"/>-->
<view class="consumption-line"> <view class="consumption-line">
<view class="semi-circle4"></view> <view class="semi-circle4" />
<view class="semi-circle3"></view> <view class="semi-circle3" />
</view> </view>
<view class="consumption-bottom"> <view class="consumption-bottom">
<view class="bottom-left">共{{total}}件商品</view> <view class="bottom-left">共{{totalNum}}件商品</view>
<view class="bottom-right"> <view class="bottom-right">
<view>订单合计: <span class="bottom-order-total">{{orderTotal}}</span></view> <view>订单合计:
<view>实付合计: <span class="bottom-point-payment">{{paymentTotal}}</span></view> <span class="bottom-order-total">{{utils.numberFormat(orderDetail.totalProductMoney/100)}}</span>
<view class="bottom-point-total">积分合计: <span class="bottom-point-num">{{pointsTotal}}</span></view> </view>
</view> <view>实付合计:
</view> <span class="bottom-point-payment">{{utils.numberFormat(orderDetail.realPayMoney/100)}}</span>
</view>
<view class="bottom-point-total">积分合计:
<span class="bottom-point-num">{{utils.numberFormat(orderDetail.couponMoney/100)}}</span>
</view>
</view>
</view>
<view class="consumption-tips">-香烟与服务类商品不计分-</view> <view class="consumption-tips">-香烟与服务类商品不计分-</view>
</view> </view>
function date(time,format){
var date = getDate(time);
// console.log(date);
return date.getFullYear() + '-' + date.getMonth() + 1 + '-'+ date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' +date.getSeconds();
}
function numberFormat(val,d){
if(val){
return val.toFixed(d || 2);
} else {
return '0.00'
}
}
function handerNickName (nickName,limitLength) {
if (nickName && nickName.length > limitLength ) {
return nickName.slice(0,limitLength) + '...'
}
return nickName || ''
}
module.exports = {
numberFormat: numberFormat,
date: date,
handerNickName: handerNickName
}
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