Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shotengai
Project
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
open-source
shotengai
Commits
d508d3fa
Commit
d508d3fa
authored
Sep 15, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve order about amount & product_amount & product_original_amount
parent
1f2477a1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
10 deletions
+19
-10
_merchant_order.json.jbuilder
...ators/templates/views/share/_merchant_order.json.jbuilder
+2
-1
_merchant_order_simple.json.jbuilder
...emplates/views/share/_merchant_order_simple.json.jbuilder
+2
-2
_order.json.jbuilder
lib/generators/templates/views/share/_order.json.jbuilder
+2
-1
_order_simple.json.jbuilder
...erators/templates/views/share/_order_simple.json.jbuilder
+3
-2
order.rb
lib/shotengai/order.rb
+10
-4
No files found.
lib/generators/templates/views/share/_merchant_order.json.jbuilder
View file @
d508d3fa
json.extract! order, :id, :seq, :address,
json.extract! order, :id, :seq, :address, :amount,
:product_amount, :product_original_amount,
:total_price, :total_original_price,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost,
...
...
lib/generators/templates/views/share/_merchant_order_simple.json.jbuilder
View file @
d508d3fa
json.extract! order, :id, :seq, :address,
:
total_price, :total_original_price
,
json.extract! order, :id, :seq, :address,
:amount
:
product_amount, :product_original_amount
,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost,
:merchant_remark, :mark, :customer_remark,
...
...
lib/generators/templates/views/share/_order.json.jbuilder
View file @
d508d3fa
json.extract! order, :id, :seq, :total_price, :total_original_price,
json.extract! order, :id, :seq, :amount,
:product_amount, :product_original_amount,
:status_zh, :address,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost, :customer_remark,
...
...
lib/generators/templates/views/share/_order_simple.json.jbuilder
View file @
d508d3fa
json.extract! order, :id, :seq, :address,
:
total_price, :total_original_price
,
json.extract! order, :id, :seq, :address,
:amount,
:
product_amount, :product_original_amount
,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost, :customer_remark,
:status, :status_zh, :meta, :created_at
\ No newline at end of file
lib/shotengai/order.rb
View file @
d508d3fa
...
...
@@ -98,10 +98,6 @@ module Shotengai
update!
(
receipt_time:
Time
.
now
)
end
def
set_amount
self
.
update!
(
amount:
product_amount
+
delivery_cost
)
end
def
set_seq
timestamp
=
Time
.
now
.
strftime
(
"%Y%m%d-%H%M"
)
no_length
=
4
...
...
@@ -109,6 +105,14 @@ module Shotengai
self
.
update!
(
seq:
"
#{
timestamp
}
-
#{
no
}
}"
)
end
def
set_amount
self
.
update!
(
amount:
product_amount
+
delivery_cost
)
end
def
amount
read_attribute
(
:amount
)
||
product_amount
+
delivery_cost
end
def
product_amount
snapshots
.
sum
(
&
:total_price
)
end
...
...
@@ -116,6 +120,8 @@ module Shotengai
def
product_original_amount
snapshots
.
sum
(
&
:total_original_price
)
end
# into order
def
incr_snapshot_ids
=
ids
...
...
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