Permalink
Browse files

close #340, add tracking companies.

  • Loading branch information...
1 parent 2e138cc commit e0bb0e1e0cac73d61fd1e9e32c608c6a3a00ef97 @saberma saberma committed Feb 1, 2012
@@ -6,20 +6,20 @@ App.Views.Order.Show.History.Fulfillment = Backbone.View.extend
initialize: ->
@options.body.hide()
- this.render()
+ @render()
render: ->
template = Handlebars.compile $('#order-history-fulfillment-item').html()
$(@el).html template @options.order_fulfillment
+ $('select[name="tracking_company"]', @el).val @options.order_fulfillment.tracking_company # 回显
@options.body.after @el
- this.$('.tracking-number').keyup()
+ @$('.tracking-number').keyup()
save: ->
self = this
attrs = notify_customer: (@$("input[name='notify_customer']").attr('checked') is 'checked'), fulfillment: {
tracking_number: this.$("input[name='tracking_number']").val(),
tracking_company: this.$("select[name='tracking_company']").val()
- tracking_company: this.$("select[name='tracking_company']").val()
}, _method: 'put'
$.post "/admin/orders/#{App.order.id}/fulfillments/#{@options.order_fulfillment.id}", attrs, ->
self.destroy()
@@ -82,7 +82,7 @@ def demo_order
end
def demo_fulfillment(order) # 物流信息
- fulfillment = order.fulfillments.new tracking_number: '1234', tracking_company: 'EMS'
+ fulfillment = order.fulfillments.new tracking_number: '1234', tracking_company: KeyValues::Order::TrackingCompany.first.code
fulfillment.line_items << order.line_items.first
fulfillment
end
@@ -39,6 +39,7 @@ class Admin::OrdersController < Admin::AppController
expose(:financial_status) { KeyValues::Order::FinancialStatus.hash }
expose(:fulfillment_status) { KeyValues::Order::FulfillmentStatus.hash }
expose(:cancel_reasons) { KeyValues::Order::CancelReason.hash }
+ expose(:tracking_companies) { KeyValues::Order::TrackingCompany.hash }
expose(:page_sizes) { KeyValues::PageSize.hash }
def index
@@ -336,8 +336,7 @@ class FulfillmentStatus < KeyValues::Base
]
end
- # 取消原因
- class CancelReason < KeyValues::Base
+ class CancelReason < KeyValues::Base # 取消原因
self.data = [
{id: 1, name: '顾客改变/取消订单', code: 'customer' },
{id: 2, name: '欺诈性订单' , code: 'fraud' },
@@ -346,6 +345,23 @@ class CancelReason < KeyValues::Base
]
end
+ class TrackingCompany < KeyValues::Base # 快递公司
+ self.data = [
+ {id: 1, name: '顺丰快递' , code: '顺丰快递' },
+ {id: 2, name: 'EMS' , code: 'EMS' },
+ {id: 3, name: '申通E物流', code: '申通E物流'},
+ {id: 4, name: '圆通速递' , code: '圆通速递' },
+ {id: 5, name: '中通速递' , code: '中通速递' },
+ {id: 6, name: '宅急送' , code: '宅急送' },
+ {id: 7, name: '韵达快运' , code: '韵达快运' },
+ {id: 8, name: '天天快递' , code: '天天快递' },
+ {id: 9, name: '联邦快递' , code: '联邦快递' },
+ {id: 10, name: '汇通快运' , code: '汇通快运' },
+ {id: 11, name: '华强物流' , code: '华强物流' },
+ {id: 12, name: '其它' , code: '其它' }
+ ]
+ end
+
end
module Link
@@ -24,9 +24,7 @@
%input.tracking-number(name="tracking_number" size="20" type="text" value="{{{tracking_number}}}")
%span.hide
通过
- %select(name="tracking_company")
- %option(value="ems") EMS
- %option(value="other") 其他
+ %select(name="tracking_company")=options_for_select tracking_companies
.st
%input(id="fulfillment_notify_customer_{{{id}}}" checked="checked" name="notify_customer" type="checkbox" value="1")
%label.note(for="fulfillment_notify_customer_{{{id}}}") 发送物流信息给顾客
@@ -112,8 +112,7 @@
%span#manual_tracking_company_area.hide
通过
%select#manual_tracking_company(disabled="disabled" name="shipping_options[manual][tracking_company]")
- %option(value="ems") EMS
- %option(value="other") 其他
+ =options_for_select tracking_companies
.btns(style="background: none")
.sb
%input#notify_customer(checked="checked" name="notify_customer" type="checkbox" value="true")
@@ -22,7 +22,7 @@
%dl
%dt
=f.label :name
- %span.note 例如:顺风,EMS 等等
+ %span.note 例如:顺丰快递,EMS 等等
%dd=f.text_field :name, maxlength: 255,size: 40, style: 'font-size: 150%'
%dt
%label 价格范围
@@ -1,4 +1,4 @@
-%h2#title 快 递
+%h2#title 快递费用
#action-links
%ul
-#
@@ -22,7 +22,7 @@
%dl
%dt
=f.label :name
- %span.note 例如:顺风,EMS 等等
+ %span.note 例如:顺丰快递,EMS 等等
%dd=f.text_field :name, maxlength: 255,size: 40, style: 'font-size: 150%'
%dt
%label 重量
@@ -25,7 +25,6 @@
has_no_link?('删除').should be_true
has_no_link?('历史').should be_true
has_link?('页面列表').should be_true
- has_link?('登录').should be_true
#登陆
visit new_admin_user_session_path

0 comments on commit e0bb0e1

Please sign in to comment.