Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
796ba9a3
Commit
796ba9a3
authored
May 24, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 订单详情
parent
92017a17
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
17 deletions
+108
-17
handler.wxs
src/component/table/handler.wxs
+23
-0
table.js
src/component/table/table.js
+4
-1
table.wxml
src/component/table/table.wxml
+7
-2
consumptionDetails.js
src/pages/consumptionDetails/consumptionDetails.js
+19
-3
consumptionDetails.wxml
src/pages/consumptionDetails/consumptionDetails.wxml
+27
-11
utils.wxs
src/wxs/utils.wxs
+28
-0
No files found.
src/component/table/handler.wxs
0 → 100644
View file @
796ba9a3
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
}
src/component/table/table.js
View file @
796ba9a3
...
@@ -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
()
{},
/**
/**
* 组件的初始数据
* 组件的初始数据
*/
*/
...
...
src/component/table/table.wxml
View file @
796ba9a3
<!--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>
src/pages/consumptionDetails/consumptionDetails.js
View file @
796ba9a3
...
@@ -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
,
total
Num
:
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
=>
{
const
{
result
,
data
}
=
res
.
data
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
({
this
.
setData
({
orderDetail
:
res
.
data
.
ddat
.
content
orderDetail
:
data
,
totalNum
:
countTotal
})
})
}
}).
finally
(()
=>
{
}).
finally
(()
=>
{
})
})
...
...
src/pages/consumptionDetails/consumptionDetails.wxml
View file @
796ba9a3
<!--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>消费时间:
<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>
</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>实付合计:
<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>
</view>
<view class="consumption-tips">-香烟与服务类商品不计分-</view>
<view class="consumption-tips">-香烟与服务类商品不计分-</view>
</view>
</view>
src/wxs/utils.wxs
0 → 100644
View file @
796ba9a3
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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment