rails_trade 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +37 -15
- data/Rakefile +9 -27
- data/app/assets/javascripts/controllers/{rails_trade_admin → trade/admin}/cart_items/create.js +0 -0
- data/app/assets/javascripts/controllers/{rails_trade_admin → trade/admin}/cart_items/index.js +0 -0
- data/app/assets/javascripts/controllers/{rails_trade_admin → trade/admin}/cart_items/only.js +0 -0
- data/app/assets/javascripts/controllers/{rails_trade_admin → trade/admin}/orders/new.js +0 -0
- data/app/assets/javascripts/controllers/trade/admin/payment_methods/edit.js +1 -0
- data/app/assets/javascripts/controllers/{rails_trade_admin → trade/admin}/payment_methods/new.js +0 -0
- data/app/assets/javascripts/controllers/trade/admin/payments/edit.js +1 -0
- data/app/assets/javascripts/controllers/{rails_trade_admin → trade/admin}/payments/new.js +0 -0
- data/app/assets/javascripts/controllers/{rails_trade_admin → trade/admin}/promote_buyers/edit.js +0 -0
- data/app/assets/javascripts/controllers/{rails_trade_admin → trade/admin}/promote_buyers/new.js +3 -1
- data/app/assets/javascripts/controllers/trade/admin/promote_charges/edit.js +1 -0
- data/app/assets/javascripts/controllers/trade/admin/promote_charges/new.js +7 -0
- data/app/assets/javascripts/controllers/trade/admin/promote_goods/edit.js +1 -0
- data/app/assets/javascripts/controllers/trade/admin/promote_goods/new.js +17 -0
- data/app/assets/javascripts/controllers/trade/admin/promotes/edit.js +2 -0
- data/app/assets/javascripts/controllers/trade/admin/promotes/new.js +5 -0
- data/app/assets/javascripts/controllers/trade/admin/refunds/index.js +1 -0
- data/app/assets/javascripts/controllers/trade/admin/refunds/new.js +1 -0
- data/app/assets/javascripts/controllers/trade/my/carts/show-phone-ready.js +1 -0
- data/app/assets/javascripts/controllers/trade/my/carts/show-ready.js +28 -0
- data/app/assets/javascripts/controllers/trade/my/orders/wait-phone.js +8 -0
- data/app/{views/goods/show.html.erb → assets/javascripts/controllers/trade/my/trade_items/create.js} +0 -0
- data/app/assets/stylesheets/controllers/trade/admin/promote_charges/index.css +4 -0
- data/app/assets/stylesheets/controllers/trade/admin/promotes/index.css +4 -0
- data/app/{views/rails_trade_admin/orders/edit.html.erb → assets/stylesheets/controllers/trade/my/carts/show-phone.css} +0 -0
- data/app/assets/stylesheets/controllers/trade/payments/wxpay_result.css +57 -0
- data/app/channels/paid_channel.rb +7 -0
- data/app/controllers/concerns/controller_order_types.rb +3 -6
- data/app/controllers/rails_trade/my_cart.rb +16 -0
- data/app/controllers/trade/admin/base_controller.rb +5 -0
- data/app/controllers/{the_trade_admin → trade/admin}/buyers_controller.rb +3 -3
- data/app/controllers/{the_trade_admin/cart_item_serves_controller.rb → trade/admin/cart_serves_controller.rb} +8 -5
- data/app/controllers/{goods_controller.rb → trade/admin/goods_controller.rb} +7 -1
- data/app/controllers/{the_trade_admin → trade/admin}/order_payments_controller.rb +6 -3
- data/app/controllers/{the_trade_admin → trade/admin}/orders_controller.rb +23 -16
- data/app/controllers/{the_trade_admin → trade/admin}/payment_methods_controller.rb +8 -5
- data/app/controllers/{the_trade_admin → trade/admin}/payment_orders_controller.rb +10 -12
- data/app/controllers/{the_trade_admin → trade/admin}/payment_references_controller.rb +3 -3
- data/app/controllers/{the_trade_admin → trade/admin}/payment_strategies_controller.rb +9 -5
- data/app/controllers/trade/admin/payments_controller.rb +97 -0
- data/app/controllers/{the_trade_admin → trade/admin}/produces_controller.rb +4 -4
- data/app/controllers/trade/admin/promote_buyers_controller.rb +57 -0
- data/app/controllers/trade/admin/promote_charges_controller.rb +67 -0
- data/app/controllers/trade/admin/promote_goods_controller.rb +63 -0
- data/app/controllers/trade/admin/promotes_controller.rb +69 -0
- data/app/controllers/{the_trade_admin → trade/admin}/refunds_controller.rb +9 -12
- data/app/controllers/{the_trade_admin/cart_items_controller.rb → trade/admin/trade_items_controller.rb} +26 -28
- data/app/controllers/trade/admin/trade_promotes_controller.rb +71 -0
- data/app/controllers/trade/buyers_controller.rb +8 -0
- data/app/controllers/trade/my/base_controller.rb +4 -0
- data/app/controllers/trade/my/carts_controller.rb +32 -0
- data/app/controllers/{the_trade_my → trade/my}/order_items_controller.rb +4 -4
- data/app/controllers/trade/my/orders_controller.rb +106 -0
- data/app/controllers/{the_trade_my → trade/my}/payment_methods_controller.rb +1 -1
- data/app/controllers/trade/my/trade_items_controller.rb +47 -0
- data/app/controllers/trade/payments_controller.rb +71 -0
- data/app/models/cart.rb +4 -0
- data/app/models/order.rb +4 -0
- data/app/models/payment.rb +4 -0
- data/app/models/payment/alipay_payment.rb +3 -0
- data/app/models/payment/apple_payment.rb +3 -0
- data/app/models/payment/bank_payment.rb +3 -0
- data/app/models/payment/hand_payment.rb +3 -0
- data/app/models/payment/paypal_payment.rb +3 -0
- data/app/models/payment/stripe_payment.rb +3 -0
- data/app/models/payment/wxpay_payment.rb +3 -0
- data/app/models/payment_method.rb +3 -0
- data/app/models/{rails_trade/payment_methods → payment_method}/alipay_method.rb +1 -1
- data/app/models/{rails_trade/payment_methods → payment_method}/bank_method.rb +1 -1
- data/app/models/payment_method/stripe_method.rb +3 -0
- data/app/models/payment_order.rb +3 -0
- data/app/models/payment_reference.rb +3 -0
- data/app/models/payment_strategy.rb +3 -0
- data/app/models/payment_type.rb +3 -0
- data/app/models/promote.rb +3 -0
- data/app/models/promote_buyer.rb +3 -0
- data/app/models/promote_charge.rb +3 -0
- data/app/models/promote_charge/cash_promote_charge.rb +3 -0
- data/app/models/promote_charge/discount_promote_charge.rb +3 -0
- data/app/models/promote_charge/final_promote_charge.rb +3 -0
- data/app/models/promote_charge/minus_promote_charge.rb +3 -0
- data/app/models/promote_charge/plus_promote_charge.rb +3 -0
- data/app/models/promote_extra.rb +3 -0
- data/app/models/promote_good.rb +3 -0
- data/app/models/rails_trade/amount.rb +44 -0
- data/app/models/rails_trade/buyer.rb +35 -0
- data/app/models/rails_trade/cart.rb +64 -0
- data/app/models/rails_trade/good.rb +71 -0
- data/app/models/rails_trade/order.rb +78 -91
- data/app/models/rails_trade/ordering/payment.rb +113 -0
- data/app/models/rails_trade/{concerns/the_refund.rb → ordering/refund.rb} +3 -5
- data/app/models/rails_trade/payment.rb +72 -73
- data/app/models/rails_trade/payment/alipay_payment.rb +15 -0
- data/app/models/rails_trade/payment/apple_payment.rb +7 -0
- data/app/models/rails_trade/{payments → payment}/bank_payment.rb +2 -4
- data/app/models/rails_trade/payment/hand_payment.rb +8 -0
- data/app/models/rails_trade/payment/paypal_payment.rb +8 -0
- data/app/models/rails_trade/payment/stripe_payment.rb +9 -0
- data/app/models/rails_trade/{payments → payment}/wxpay_payment.rb +1 -2
- data/app/models/rails_trade/payment_method.rb +22 -12
- data/app/models/rails_trade/{payment_methods → payment_method}/stripe_method.rb +7 -4
- data/app/models/rails_trade/payment_order.rb +84 -51
- data/app/models/rails_trade/payment_reference.rb +12 -9
- data/app/models/rails_trade/payment_strategy.rb +15 -12
- data/app/models/rails_trade/payment_type/alipay.rb +28 -0
- data/app/models/rails_trade/payment_type/apple_pay.rb +18 -0
- data/app/models/rails_trade/{payment_interface/the_paypal.rb → payment_type/paypal.rb} +8 -29
- data/app/models/rails_trade/{payment_interface/the_stripe.rb → payment_type/stripe.rb} +8 -26
- data/app/models/rails_trade/payment_type/wxpay.rb +55 -0
- data/app/models/rails_trade/promote.rb +65 -27
- data/app/models/rails_trade/promote_buyer.rb +25 -7
- data/app/models/rails_trade/promote_charge.rb +78 -11
- data/app/models/rails_trade/promote_charge/cash_promote_charge.rb +12 -0
- data/app/models/rails_trade/promote_charge/discount_promote_charge.rb +17 -0
- data/app/models/rails_trade/promote_charge/final_promote_charge.rb +12 -0
- data/app/models/rails_trade/promote_charge/minus_promote_charge.rb +11 -0
- data/app/models/rails_trade/promote_charge/plus_promote_charge.rb +7 -0
- data/app/models/rails_trade/promote_extra.rb +13 -0
- data/app/models/rails_trade/promote_good.rb +20 -7
- data/app/models/rails_trade/refund.rb +30 -19
- data/app/models/rails_trade/{refunds → refund}/alipay_refund.rb +1 -1
- data/app/models/rails_trade/refund/bank_refund.rb +5 -0
- data/app/models/rails_trade/refund/hand_refund.rb +5 -0
- data/app/models/rails_trade/{refunds → refund}/paypal_refund.rb +1 -1
- data/app/models/rails_trade/{refunds → refund}/stripe_refund.rb +1 -1
- data/app/models/rails_trade/{refunds → refund}/wxpay_refund.rb +17 -9
- data/app/models/rails_trade/sell.rb +24 -0
- data/app/models/rails_trade/trade_item.rb +153 -0
- data/app/models/rails_trade/trade_promote.rb +92 -0
- data/app/models/rails_trade/user.rb +9 -0
- data/app/models/refund.rb +3 -0
- data/app/models/refund/alipay_refund.rb +3 -0
- data/app/models/refund/bank_refund.rb +3 -0
- data/app/models/refund/hand_refund.rb +3 -0
- data/app/models/refund/paypal_refund.rb +3 -0
- data/app/models/refund/stripe_refund.rb +3 -0
- data/app/models/refund/wxpay_refund.rb +3 -0
- data/app/models/trade_item.rb +3 -0
- data/app/models/trade_promote.rb +3 -0
- data/app/views/application/_trade_nav.html.erb +16 -0
- data/app/views/my/_trade_nav.html.erb +10 -0
- data/app/views/{rails_trade_admin → trade/admin}/buyers/_form.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/buyers/_menu.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/buyers/_search_form.html.erb +3 -3
- data/app/views/{rails_trade_admin → trade/admin}/buyers/edit.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/buyers/index.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/buyers/new.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/buyers/orders.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/buyers/overdue.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/buyers/show.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/_check.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/_index.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/_new.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/_serve.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/_single.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/_single_table.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/_total.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/_total_table.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/add.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/create.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/destroy.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/index.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/new.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/single.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/cart_item_serves/total.js.erb +0 -0
- data/app/views/trade/admin/goods/_form.html.erb +7 -0
- data/app/views/{rails_trade_admin → trade/admin}/goods/_item.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/goods/_new.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/goods/_show.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/goods/_show_tr.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/goods/create.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/goods/destroy.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/goods/edit.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/goods/edit.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/goods/edit_items.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/goods/edit_pic.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/goods/edit_promote.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/goods/index.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/goods/new.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/goods/new.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/goods/show.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/goods/update.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/order_payments/_index.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/order_payments/_new.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/order_payments/_payment_orders.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/order_payments/_payments.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/order_payments/create.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/order_payments/create_fail.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/order_payments/destroy.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/order_payments/index.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/order_payments/new.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/orders/_addresses.html.erb +1 -1
- data/app/views/trade/admin/orders/_filter.html.erb +26 -0
- data/app/views/trade/admin/orders/_form.html.erb +4 -0
- data/app/views/{rails_trade_admin → trade/admin}/orders/_invoice_addresses.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/orders/_item.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/orders/_new_items.html.erb +1 -1
- data/app/{assets/javascripts/controllers/rails_trade_admin/payments/index.js → views/trade/admin/orders/_search_form.html.erb} +0 -0
- data/app/views/trade/admin/orders/index.html.erb +52 -0
- data/app/views/{rails_trade_admin → trade/admin}/orders/new.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/orders/payments.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/orders/refresh.js.erb +0 -0
- data/app/views/trade/admin/orders/show.html.erb +75 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/_edit.html.erb +0 -0
- data/app/views/{rails_trade_admin/payment_methods/_search_form.html.erb → trade/admin/payment_methods/_filter.html.erb} +5 -9
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/_form.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/_index_layout.html.erb +2 -5
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/_new.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/_payment_method.html.erb +2 -3
- data/app/views/trade/admin/payment_methods/create.js.erb +2 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/destroy.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/edit.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/edit.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/index.html.erb +7 -4
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/mine.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/new.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/new.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/unverified.html.erb +4 -6
- data/app/views/{rails_trade_admin → trade/admin}/payment_methods/update.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_orders/_index.html.erb +2 -6
- data/app/views/trade/admin/payment_orders/_new.html.erb +23 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_orders/_orders.html.erb +2 -9
- data/app/views/{rails_trade_admin → trade/admin}/payment_orders/cancel.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_orders/create.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_orders/create_fail.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_orders/new.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_orders/raise_fail.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_orders/update.js.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/payment_orders/update_fail.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_references/_form.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/payment_references/_new.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/payment_references/destroy.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_references/edit.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_references/index.html.erb +1 -1
- data/app/views/{rails_trade_admin → trade/admin}/payment_references/new.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_references/show.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_strategies/_form.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payment_strategies/edit.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/payment_strategies/index.html.erb +2 -2
- data/app/views/{rails_trade_admin → trade/admin}/payment_strategies/new.html.erb +1 -1
- data/app/views/trade/admin/payments/_checked_amount.html.erb +6 -0
- data/app/views/trade/admin/payments/_edit.html.erb +12 -0
- data/app/views/trade/admin/payments/_filter.html.erb +40 -0
- data/app/views/{rails_trade_admin → trade/admin}/payments/_form.html.erb +6 -2
- data/app/views/trade/admin/payments/_item.html.erb +41 -0
- data/app/views/trade/admin/payments/_new.html.erb +12 -0
- data/app/views/{rails_trade_admin → trade/admin}/payments/analyze.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/payments/dashboard.html.erb +0 -0
- data/app/views/trade/admin/payments/edit.html.erb +13 -0
- data/app/views/trade/admin/payments/edit.js.erb +3 -0
- data/app/views/trade/admin/payments/index.html.erb +40 -0
- data/app/views/trade/admin/payments/new.html.erb +13 -0
- data/app/views/trade/admin/payments/new.js.erb +3 -0
- data/app/views/{rails_trade_admin → trade/admin}/payments/show.html.erb +0 -0
- data/app/views/trade/admin/promote_buyers/_filter.html.erb +7 -0
- data/app/views/trade/admin/promote_buyers/_form.html.erb +17 -0
- data/app/views/{rails_trade_admin → trade/admin}/promote_buyers/_promote_buyer.json.jbuilder +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/promote_buyers/edit.html.erb +1 -1
- data/app/views/trade/admin/promote_buyers/edit.js.erb +3 -0
- data/app/views/trade/admin/promote_buyers/index.html.erb +52 -0
- data/app/views/{rails_trade_admin → trade/admin}/promote_buyers/index.json.jbuilder +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/promote_buyers/new.html.erb +1 -1
- data/app/views/trade/admin/promote_buyers/new.js.erb +3 -0
- data/app/views/{rails_trade_admin → trade/admin}/promote_buyers/show.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/promote_buyers/show.json.jbuilder +0 -0
- data/app/views/trade/admin/promote_charges/_base_price_form.html.erb +1 -0
- data/app/views/trade/admin/promote_charges/_edit.html.erb +13 -0
- data/app/views/trade/admin/promote_charges/_filter.html.erb +11 -0
- data/app/views/trade/admin/promote_charges/_form.html.erb +11 -0
- data/app/views/trade/admin/promote_charges/_new.html.erb +13 -0
- data/app/views/trade/admin/promote_charges/index.html.erb +65 -0
- data/app/views/trade/admin/promote_charges/options.js.erb +4 -0
- data/app/views/trade/admin/promote_goods/_filter.html.erb +8 -0
- data/app/views/trade/admin/promote_goods/_form.html.erb +8 -0
- data/app/views/trade/admin/promote_goods/_goods_options.html.erb +1 -0
- data/app/views/trade/admin/promote_goods/goods.js.erb +2 -0
- data/app/views/trade/admin/promote_goods/index.html.erb +61 -0
- data/app/views/trade/admin/promotes/_edit.html.erb +12 -0
- data/app/views/trade/admin/promotes/_filter.html.erb +9 -0
- data/app/views/trade/admin/promotes/_form.html.erb +12 -0
- data/app/views/trade/admin/promotes/_new.html.erb +12 -0
- data/app/views/trade/admin/promotes/_new_promote_charge.html.erb +10 -0
- data/app/views/trade/admin/promotes/create.js.erb +2 -0
- data/app/views/trade/admin/promotes/index.html.erb +79 -0
- data/app/views/trade/admin/refunds/_filter.html.erb +11 -0
- data/app/views/{rails_trade_admin → trade/admin}/refunds/_form.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/refunds/_logs_table.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/refunds/_new.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/refunds/edit.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/refunds/index.html.erb +13 -17
- data/app/views/{rails_trade_admin → trade/admin}/refunds/logs.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/refunds/new.html.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/refunds/new.js.erb +0 -0
- data/app/views/{rails_trade_admin → trade/admin}/refunds/show.html.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/_additions.html.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/_filter.html.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/_good_price.html.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/_order_price.html.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/_retail_price.html.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/_single_price.html.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/_total_price.html.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/destroy.js.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/error.html.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/index.html.erb +3 -3
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/only.html.erb +2 -2
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/total.js.erb +0 -0
- data/app/views/{rails_trade_admin/cart_items → trade/admin/trade_items}/update.js.erb +0 -0
- data/app/views/trade/admin/trade_promotes/_filter.html.erb +7 -0
- data/app/views/trade/admin/trade_promotes/_form.html.erb +6 -0
- data/app/views/trade/admin/trade_promotes/_show_table.html.erb +20 -0
- data/app/views/trade/admin/trade_promotes/edit.html.erb +9 -0
- data/app/views/trade/admin/trade_promotes/edit.js.erb +3 -0
- data/app/views/trade/admin/trade_promotes/index.html.erb +38 -0
- data/app/views/trade/admin/trade_promotes/new.html.erb +9 -0
- data/app/views/trade/admin/trade_promotes/new.js.erb +3 -0
- data/app/views/trade/admin/trade_promotes/show.html.erb +7 -0
- data/app/views/trade/admin/trade_promotes/show.js.erb +3 -0
- data/app/views/trade/admin/trade_promotes/update.js.erb +1 -0
- data/app/views/{buyers → trade/buyers}/_show.html.erb +0 -0
- data/app/views/{buyers → trade/buyers}/show.js.erb +0 -0
- data/app/views/{goods → trade/goods}/_choose.html.erb +0 -0
- data/app/views/{goods → trade/goods}/_good.html.erb +0 -0
- data/app/views/{goods → trade/goods}/_good_item.html.erb +0 -0
- data/app/views/{goods → trade/goods}/_nav.html.erb +0 -0
- data/app/views/{goods → trade/goods}/_search.html.erb +0 -0
- data/app/views/{goods → trade/goods}/index.html.erb +0 -0
- data/app/views/{goods → trade/goods}/index/_product.html.erb +0 -0
- data/app/views/{goods → trade/goods}/item.html.erb +0 -0
- data/app/views/{goods → trade/goods}/produce.html.erb +0 -0
- data/app/views/trade/goods/show.html.erb +2 -0
- data/app/views/{goods → trade/goods}/show/_basic.html.erb +0 -0
- data/app/views/{goods → trade/goods}/show/_carousel.html.erb +0 -0
- data/app/views/{goods → trade/goods}/show/_items.html.erb +0 -0
- data/app/views/{goods → trade/goods}/show/_sales.html.erb +0 -0
- data/app/views/{goods → trade/goods}/show/_side.html.erb +0 -0
- data/app/views/{goods → trade/goods}/taxon/_breadcrumb.html.erb +0 -0
- data/app/views/{goods → trade/goods}/taxon/_nav.html.erb +0 -0
- data/app/views/{goods → trade/goods}/taxon/_nav_.html.erb +0 -0
- data/app/views/{goods → trade/goods}/taxon/_nav_last.html.erb +0 -0
- data/app/views/trade/my/carts/_filter.html.erb +7 -0
- data/app/views/trade/my/carts/_form.html.erb +8 -0
- data/app/views/trade/my/carts/_show_table.html.erb +28 -0
- data/app/views/trade/my/carts/edit.html.erb +9 -0
- data/app/views/trade/my/carts/edit.js.erb +3 -0
- data/app/views/trade/my/carts/index.html.erb +47 -0
- data/app/views/trade/my/carts/new.html.erb +9 -0
- data/app/views/trade/my/carts/new.js.erb +3 -0
- data/app/views/trade/my/carts/show.html+phone.erb +46 -0
- data/app/views/{rails_trade_admin/promote_goods → trade/my/carts}/show.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/order_items/_form.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/order_items/edit.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/order_items/index.html.erb +1 -1
- data/app/views/{rails_trade_my → trade/my}/order_items/new.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/order_items/show.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/orders/_date_form.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/orders/_edit.html.erb +2 -2
- data/app/views/trade/my/orders/_edit_payment_type.html.erb +12 -0
- data/app/views/{rails_trade_my → trade/my}/orders/_form.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/orders/destroy.js.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/orders/edit.js.erb +0 -0
- data/app/views/trade/my/orders/edit_payment_type.js.erb +4 -0
- data/app/views/{rails_trade_my → trade/my}/orders/fail.html.erb +0 -0
- data/app/views/trade/my/orders/index.html+phone.erb +37 -0
- data/app/views/trade/my/orders/index.html.erb +36 -0
- data/app/views/{rails_trade_my → trade/my}/orders/index.json.jbuilder +0 -0
- data/app/views/{rails_trade_my → trade/my}/orders/new.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/orders/refresh.js.erb +0 -0
- data/app/views/trade/my/orders/refund.json.jbuilder +12 -0
- data/app/views/trade/my/orders/show.html+phone.erb +3 -0
- data/app/views/{rails_trade_my → trade/my}/orders/show.html.erb +3 -3
- data/app/views/{rails_trade_my → trade/my}/orders/success.html.erb +0 -2
- data/app/views/{rails_trade_my → trade/my}/orders/update.js.erb +1 -1
- data/app/views/trade/my/orders/wait.html+wechat.erb +4 -0
- data/app/views/trade/my/orders/wxpay_pay.js.erb +16 -0
- data/app/views/trade/my/orders/wxpay_pay_err.js.erb +5 -0
- data/app/views/{rails_trade_my → trade/my}/payment_methods/_edit.html.erb +1 -1
- data/app/views/{rails_trade_my → trade/my}/payment_methods/_form.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/payment_methods/_index.html.erb +1 -1
- data/app/views/{rails_trade_my → trade/my}/payment_methods/_item.html.erb +1 -1
- data/app/views/{rails_trade_my → trade/my}/payment_methods/_new.html.erb +3 -3
- data/app/views/{rails_trade_my → trade/my}/payment_methods/create.js.erb +0 -0
- data/app/views/{rails_trade_my/addresses → trade/my/payment_methods}/destroy.js.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/payment_methods/edit.js.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/payment_methods/index.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/payment_methods/index.js.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/payment_methods/new.js.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/payment_methods/show.html.erb +0 -0
- data/app/views/{rails_trade_my/addresses → trade/my/payment_methods}/update.js.erb +0 -0
- data/app/views/trade/my/trade_items/_additions.html.erb +12 -0
- data/app/views/trade/my/trade_items/_cart_item.js.erb +2 -0
- data/app/views/trade/my/trade_items/_single_price.html.erb +6 -0
- data/app/views/trade/my/trade_items/_total_price.html.erb +8 -0
- data/app/views/trade/my/trade_items/_trade_items.html.erb +68 -0
- data/app/views/trade/my/trade_items/create.html.erb +1 -0
- data/app/views/{rails_trade_my/cart_items → trade/my/trade_items}/destroy.js.erb +0 -0
- data/app/views/trade/my/trade_items/index.json.jbuilder +0 -0
- data/app/views/trade/my/trade_items/update.js.erb +1 -0
- data/app/views/{rails_trade_my → trade/my}/users/_form.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/users/edit.html.erb +0 -0
- data/app/views/{rails_trade_my → trade/my}/users/show.html.erb +0 -0
- data/app/views/trade/payments/_wxpay_result.html.erb +3 -0
- data/app/views/trade/payments/wxpay_result.js.erb +1 -0
- data/config/locales/en.enum.yml +47 -0
- data/config/locales/en.yml +22 -60
- data/config/locales/zh.attributes.yml +75 -0
- data/config/locales/zh.controller.yml +51 -0
- data/config/locales/zh.enum.yml +58 -0
- data/config/locales/zh.help.yml +7 -0
- data/config/routes.rb +45 -59
- data/lib/rails_trade.rb +9 -19
- data/lib/rails_trade/apple_pay.rb +32 -0
- data/lib/rails_trade/config.rb +6 -3
- data/lib/rails_trade/engine.rb +15 -19
- data/lib/rails_trade/version.rb +1 -1
- metadata +475 -422
- data/app/assets/config/rails_trade_manifest.js +0 -1
- data/app/assets/javascripts/controllers/rails_trade_admin/buyers/index.js +0 -15
- data/app/assets/javascripts/controllers/rails_trade_admin/buyers/overdue.js +0 -15
- data/app/assets/javascripts/controllers/rails_trade_admin/payment_methods/edit.js +0 -1
- data/app/assets/javascripts/controllers/rails_trade_admin/payment_methods/index.js +0 -1
- data/app/assets/javascripts/controllers/rails_trade_admin/payment_methods/unverified.js +0 -1
- data/app/assets/javascripts/controllers/rails_trade_admin/promote_goods/index.js +0 -1
- data/app/assets/javascripts/controllers/rails_trade_admin/promotes/edit.js +0 -2
- data/app/assets/javascripts/controllers/rails_trade_admin/promotes/index.js +0 -1
- data/app/assets/javascripts/controllers/rails_trade_admin/promotes/new.js +0 -2
- data/app/assets/javascripts/controllers/rails_trade_admin/serves/edit.js +0 -2
- data/app/assets/javascripts/controllers/rails_trade_admin/serves/index.js +0 -1
- data/app/assets/javascripts/controllers/rails_trade_admin/serves/new.js +0 -4
- data/app/assets/javascripts/controllers/rails_trade_my/cart_items/create.js +0 -3
- data/app/assets/javascripts/controllers/rails_trade_my/cart_items/index.js +0 -65
- data/app/controllers/areas_controller.rb +0 -18
- data/app/controllers/buyers_controller.rb +0 -8
- data/app/controllers/payments_controller.rb +0 -50
- data/app/controllers/providers_controller.rb +0 -8
- data/app/controllers/the_trade_admin/addresses_controller.rb +0 -75
- data/app/controllers/the_trade_admin/areas_controller.rb +0 -50
- data/app/controllers/the_trade_admin/base_controller.rb +0 -5
- data/app/controllers/the_trade_admin/payments_controller.rb +0 -89
- data/app/controllers/the_trade_admin/promote_buyers_controller.rb +0 -39
- data/app/controllers/the_trade_admin/promote_charges_controller.rb +0 -62
- data/app/controllers/the_trade_admin/promote_goods_controller.rb +0 -50
- data/app/controllers/the_trade_admin/promotes_controller.rb +0 -105
- data/app/controllers/the_trade_admin/providers_controller.rb +0 -121
- data/app/controllers/the_trade_admin/serve_charges_controller.rb +0 -67
- data/app/controllers/the_trade_admin/serves_controller.rb +0 -107
- data/app/controllers/the_trade_my/addresses_controller.rb +0 -50
- data/app/controllers/the_trade_my/base_controller.rb +0 -13
- data/app/controllers/the_trade_my/buyers_controller.rb +0 -35
- data/app/controllers/the_trade_my/cart_items_controller.rb +0 -71
- data/app/controllers/the_trade_my/orders_controller.rb +0 -161
- data/app/controllers/the_trade_my/providers_controller.rb +0 -44
- data/app/models/rails_trade/address.rb +0 -14
- data/app/models/rails_trade/area.rb +0 -65
- data/app/models/rails_trade/cart_item.rb +0 -185
- data/app/models/rails_trade/cart_item_serve.rb +0 -16
- data/app/models/rails_trade/concerns/good_able.rb +0 -63
- data/app/models/rails_trade/concerns/order_able.rb +0 -48
- data/app/models/rails_trade/concerns/promote_fee.rb +0 -54
- data/app/models/rails_trade/concerns/serve_fee.rb +0 -41
- data/app/models/rails_trade/concerns/summary_service.rb +0 -67
- data/app/models/rails_trade/concerns/the_payment.rb +0 -88
- data/app/models/rails_trade/concerns/the_trade_buyer.rb +0 -50
- data/app/models/rails_trade/concerns/the_trade_user.rb +0 -23
- data/app/models/rails_trade/good_partner.rb +0 -8
- data/app/models/rails_trade/good_produce.rb +0 -14
- data/app/models/rails_trade/order_item.rb +0 -88
- data/app/models/rails_trade/order_promote.rb +0 -23
- data/app/models/rails_trade/order_serve.rb +0 -23
- data/app/models/rails_trade/order_shipment.rb +0 -10
- data/app/models/rails_trade/payment_interface/payment_interface_base.rb +0 -8
- data/app/models/rails_trade/payment_interface/the_alipay.rb +0 -49
- data/app/models/rails_trade/payment_interface/the_wxpay.rb +0 -56
- data/app/models/rails_trade/payments/alipay_payment.rb +0 -12
- data/app/models/rails_trade/payments/hand_payment.rb +0 -13
- data/app/models/rails_trade/payments/paypal_payment.rb +0 -8
- data/app/models/rails_trade/payments/stripe_payment.rb +0 -7
- data/app/models/rails_trade/produce.rb +0 -18
- data/app/models/rails_trade/promote_charges/single_promote_charge.rb +0 -7
- data/app/models/rails_trade/promote_charges/total_promote_charge.rb +0 -7
- data/app/models/rails_trade/promotes/amount_promote.rb +0 -4
- data/app/models/rails_trade/promotes/number_promote.rb +0 -4
- data/app/models/rails_trade/provider.rb +0 -25
- data/app/models/rails_trade/refunds/bank_refund.rb +0 -5
- data/app/models/rails_trade/refunds/hand_refund.rb +0 -5
- data/app/models/rails_trade/serve.rb +0 -44
- data/app/models/rails_trade/serve_charge.rb +0 -37
- data/app/models/rails_trade/serve_charges/single_serve_charge.rb +0 -7
- data/app/models/rails_trade/serve_charges/total_serve_charge.rb +0 -7
- data/app/models/rails_trade/serve_good.rb +0 -9
- data/app/models/rails_trade/serves/number_serve.rb +0 -4
- data/app/models/rails_trade/serves/quantity_serve.rb +0 -4
- data/app/models/rails_trade/shipment.rb +0 -8
- data/app/views/layouts/rails_trade_admin/base.html.erb +0 -25
- data/app/views/layouts/rails_trade_my/base.html.erb +0 -28
- data/app/views/rails_trade_admin/addresses/_address.html.erb +0 -24
- data/app/views/rails_trade_admin/addresses/_edit.html.erb +0 -13
- data/app/views/rails_trade_admin/addresses/_form.html.erb +0 -23
- data/app/views/rails_trade_admin/addresses/_new.html.erb +0 -13
- data/app/views/rails_trade_admin/addresses/create.js.erb +0 -2
- data/app/views/rails_trade_admin/addresses/destroy.js.erb +0 -1
- data/app/views/rails_trade_admin/addresses/edit.js.erb +0 -39
- data/app/views/rails_trade_admin/addresses/index.html.erb +0 -41
- data/app/views/rails_trade_admin/addresses/new.js.erb +0 -52
- data/app/views/rails_trade_admin/addresses/show.html.erb +0 -4
- data/app/views/rails_trade_admin/addresses/update.js.erb +0 -2
- data/app/views/rails_trade_admin/areas/_form.html.erb +0 -9
- data/app/views/rails_trade_admin/areas/edit.html.erb +0 -16
- data/app/views/rails_trade_admin/areas/index.html.erb +0 -43
- data/app/views/rails_trade_admin/areas/new.html.erb +0 -11
- data/app/views/rails_trade_admin/areas/show.html.erb +0 -1
- data/app/views/rails_trade_admin/base/_nav.html.erb +0 -24
- data/app/views/rails_trade_admin/base/_nav_bar.html.erb +0 -23
- data/app/views/rails_trade_admin/base/_nav_payment.html.erb +0 -25
- data/app/views/rails_trade_admin/goods/_form.html.erb +0 -7
- data/app/views/rails_trade_admin/orders/_filter.html.erb +0 -20
- data/app/views/rails_trade_admin/orders/_form.html.erb +0 -17
- data/app/views/rails_trade_admin/orders/_search_form.html.erb +0 -7
- data/app/views/rails_trade_admin/orders/index.html.erb +0 -61
- data/app/views/rails_trade_admin/orders/show.html.erb +0 -89
- data/app/views/rails_trade_admin/payment_methods/create.js.erb +0 -2
- data/app/views/rails_trade_admin/payment_orders/_new.html.erb +0 -24
- data/app/views/rails_trade_admin/payments/_item.html.erb +0 -49
- data/app/views/rails_trade_admin/payments/_search_form.html.erb +0 -15
- data/app/views/rails_trade_admin/payments/edit.html.erb +0 -15
- data/app/views/rails_trade_admin/payments/index.html.erb +0 -60
- data/app/views/rails_trade_admin/payments/new.html.erb +0 -17
- data/app/views/rails_trade_admin/promote_buyers/_form.html.erb +0 -6
- data/app/views/rails_trade_admin/promote_buyers/index.html.erb +0 -42
- data/app/views/rails_trade_admin/promote_charges/_edit.html.erb +0 -13
- data/app/views/rails_trade_admin/promote_charges/_form.html.erb +0 -6
- data/app/views/rails_trade_admin/promote_charges/_new.html.erb +0 -13
- data/app/views/rails_trade_admin/promote_charges/_search_form.html.erb +0 -9
- data/app/views/rails_trade_admin/promote_charges/edit.js.erb +0 -8
- data/app/views/rails_trade_admin/promote_charges/index.html.erb +0 -49
- data/app/views/rails_trade_admin/promote_charges/new.js.erb +0 -8
- data/app/views/rails_trade_admin/promote_goods/_form.html.erb +0 -4
- data/app/views/rails_trade_admin/promote_goods/_promote_good.json.jbuilder +0 -2
- data/app/views/rails_trade_admin/promote_goods/edit.html.erb +0 -14
- data/app/views/rails_trade_admin/promote_goods/index.html.erb +0 -37
- data/app/views/rails_trade_admin/promote_goods/index.json.jbuilder +0 -1
- data/app/views/rails_trade_admin/promote_goods/new.html.erb +0 -13
- data/app/views/rails_trade_admin/promote_goods/show.json.jbuilder +0 -1
- data/app/views/rails_trade_admin/promotes/_form.html.erb +0 -9
- data/app/views/rails_trade_admin/promotes/edit.html.erb +0 -9
- data/app/views/rails_trade_admin/promotes/index.html.erb +0 -65
- data/app/views/rails_trade_admin/promotes/new.html.erb +0 -9
- data/app/views/rails_trade_admin/promotes/show.html.erb +0 -4
- data/app/views/rails_trade_admin/providers/_form.html.erb +0 -6
- data/app/views/rails_trade_admin/providers/_product.html.erb +0 -12
- data/app/views/rails_trade_admin/providers/_side.html.erb +0 -8
- data/app/views/rails_trade_admin/providers/area.html.erb +0 -1
- data/app/views/rails_trade_admin/providers/channel.html.erb +0 -46
- data/app/views/rails_trade_admin/providers/edit.html.erb +0 -16
- data/app/views/rails_trade_admin/providers/index.html.erb +0 -27
- data/app/views/rails_trade_admin/providers/new.html.erb +0 -21
- data/app/views/rails_trade_admin/providers/posts.html.erb +0 -41
- data/app/views/rails_trade_admin/providers/products.html.erb +0 -23
- data/app/views/rails_trade_admin/providers/show.html.erb +0 -60
- data/app/views/rails_trade_admin/refunds/_search_form.html.erb +0 -13
- data/app/views/rails_trade_admin/serve_charges/_edit.html.erb +0 -13
- data/app/views/rails_trade_admin/serve_charges/_form.html.erb +0 -10
- data/app/views/rails_trade_admin/serve_charges/_new.html.erb +0 -13
- data/app/views/rails_trade_admin/serve_charges/_search_form.html.erb +0 -10
- data/app/views/rails_trade_admin/serve_charges/edit.js.erb +0 -7
- data/app/views/rails_trade_admin/serve_charges/index.html.erb +0 -56
- data/app/views/rails_trade_admin/serve_charges/new.js.erb +0 -8
- data/app/views/rails_trade_admin/serves/_form.html.erb +0 -9
- data/app/views/rails_trade_admin/serves/edit.html.erb +0 -9
- data/app/views/rails_trade_admin/serves/index.html.erb +0 -80
- data/app/views/rails_trade_admin/serves/new.html.erb +0 -9
- data/app/views/rails_trade_my/addresses/_edit.html.erb +0 -31
- data/app/views/rails_trade_my/addresses/_form.html.erb +0 -23
- data/app/views/rails_trade_my/addresses/_new.html.erb +0 -11
- data/app/views/rails_trade_my/addresses/create.js.erb +0 -2
- data/app/views/rails_trade_my/addresses/edit.js.erb +0 -39
- data/app/views/rails_trade_my/addresses/index.html.erb +0 -44
- data/app/views/rails_trade_my/addresses/new.js.erb +0 -39
- data/app/views/rails_trade_my/addresses/show.html.erb +0 -4
- data/app/views/rails_trade_my/base/_nav.html.erb +0 -22
- data/app/views/rails_trade_my/buyers/_form.html.erb +0 -5
- data/app/views/rails_trade_my/buyers/edit.html.erb +0 -2
- data/app/views/rails_trade_my/buyers/show.html.erb +0 -21
- data/app/views/rails_trade_my/cart_items/_additions.html.erb +0 -22
- data/app/views/rails_trade_my/cart_items/_single_price.html.erb +0 -6
- data/app/views/rails_trade_my/cart_items/_total_price.html.erb +0 -8
- data/app/views/rails_trade_my/cart_items/index.html.erb +0 -69
- data/app/views/rails_trade_my/cart_items/total.js.erb +0 -11
- data/app/views/rails_trade_my/cart_items/update.js.erb +0 -8
- data/app/views/rails_trade_my/my/index.html.erb +0 -17
- data/app/views/rails_trade_my/orders/_edit_payment_type.html.erb +0 -13
- data/app/views/rails_trade_my/orders/edit_payment_type.js.erb +0 -6
- data/app/views/rails_trade_my/orders/index.html.erb +0 -55
- data/app/views/rails_trade_my/orders/update_payment_type.js.erb +0 -3
- data/app/views/rails_trade_my/orders/wxpay_pay.js.erb +0 -16
- data/app/views/rails_trade_my/orders/wxpay_pay_err.js.erb +0 -5
- data/app/views/rails_trade_my/payment_methods/destroy.js.erb +0 -1
- data/app/views/rails_trade_my/payment_methods/update.js.erb +0 -2
- data/app/views/rails_trade_my/providers/_form.html.erb +0 -5
- data/app/views/rails_trade_my/providers/_provider.html.erb +0 -20
- data/app/views/rails_trade_my/providers/edit.html.erb +0 -2
- data/app/views/rails_trade_my/providers/index.html.erb +0 -12
- data/app/views/rails_trade_my/providers/new.html.erb +0 -10
- data/app/views/rails_trade_my/providers/show.html.erb +0 -13
- data/config/locales/zh.yml +0 -75
- data/db/migrate/20150514135720_create_providers.rb +0 -59
- data/db/migrate/20170601014520_create_payments.rb +0 -52
- data/db/migrate/20170602061859_create_payment_references.rb +0 -12
- data/db/migrate/20170702234123_create_orders.rb +0 -56
- data/db/migrate/20170714080032_create_payment_strategies.rb +0 -77
- data/db/migrate/20171115063702_create_promote_buyers.rb +0 -31
- data/db/schema.rb +0 -94
- data/lib/tasks/the_trade_tasks.rake +0 -4
@@ -0,0 +1,17 @@
|
|
1
|
+
# 折扣价格
|
2
|
+
module RailsTrade::PromoteCharge::DiscountPromoteCharge
|
3
|
+
|
4
|
+
# 用户输入参数可为
|
5
|
+
# 正数的折扣,原价 * 折扣, 如 100 * 0.7, parameter 为0.7
|
6
|
+
# 负数的折扣,原价 * (1+折扣),如 100 * (1-0.3), parameter 为 -0.3
|
7
|
+
def final_price(amount)
|
8
|
+
if parameter < 0 && parameter > -1
|
9
|
+
(amount * parameter).round(2)
|
10
|
+
elsif parameter > 0 && parameter < 1
|
11
|
+
-(amount * (1 - parameter)).round(2)
|
12
|
+
else
|
13
|
+
amount
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -1,9 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module RailsTrade::PromoteGood
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
attribute :status, :string, default: 'available'
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
belongs_to :promote
|
8
|
+
belongs_to :good, polymorphic: true, optional: true
|
9
|
+
has_many :promote_buyers, dependent: :delete_all
|
10
|
+
|
11
|
+
scope :valid, -> { where(status: ['default', 'available']) }
|
12
|
+
|
13
|
+
enum status: {
|
14
|
+
default: 'default', # 默认直接添加的服务,不可取消
|
15
|
+
available: 'available', # 可选
|
16
|
+
unavailable: 'unavailable' # 不可选
|
17
|
+
}
|
18
|
+
|
19
|
+
validates :promote_id, uniqueness: { scope: [:good_type, :good_id] }
|
20
|
+
end
|
9
21
|
|
22
|
+
end
|
@@ -1,23 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
module RailsTrade::Refund
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
included do
|
4
|
+
attribute :type, :string
|
5
|
+
attribute :currency, :string, default: RailsTrade.config.default_currency
|
6
|
+
attribute :total_amount, :decimal, precision: 10, scale: 2
|
7
|
+
attribute :buyer_identifier, :string
|
8
|
+
attribute :comment, :string, limit: 512
|
9
|
+
attribute :state, :string, default: 'init'
|
10
|
+
attribute :refunded_at, :datetime
|
11
|
+
attribute :reason, :string, limit: 512
|
12
|
+
attribute :refund_uuid, :string
|
13
|
+
attribute :response, :json
|
14
|
+
|
15
|
+
belongs_to :operator, polymorphic: true, optional: true
|
16
|
+
belongs_to :order, inverse_of: :refunds, optional: true
|
17
|
+
belongs_to :payment
|
18
|
+
|
19
|
+
validates :payment_id, uniqueness: { scope: :order_id }
|
20
|
+
|
21
|
+
after_initialize if: -> { new_record? } do
|
22
|
+
self.refund_uuid ||= UidHelper.nsec_uuid('RD')
|
23
|
+
self.state = :init
|
24
|
+
end
|
9
25
|
|
10
|
-
|
11
|
-
|
12
|
-
|
26
|
+
enum state: {
|
27
|
+
init: 'init',
|
28
|
+
completed: 'completed',
|
29
|
+
failed: 'failed'
|
30
|
+
}
|
13
31
|
end
|
14
|
-
|
15
|
-
enum state: [
|
16
|
-
:init,
|
17
|
-
:completed,
|
18
|
-
:failed
|
19
|
-
]
|
20
|
-
|
21
32
|
#validate :valid_total_amount
|
22
33
|
|
23
34
|
# 微信是同一个批次号未退款成功可重复申请
|
@@ -60,4 +71,4 @@ class Refund < ApplicationRecord
|
|
60
71
|
self.init? && ['all_paid', 'part_paid', 'refunding'].include?(order.payment_status)
|
61
72
|
end
|
62
73
|
|
63
|
-
end
|
74
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
module RailsTrade::Refund::WxpayRefund
|
2
2
|
|
3
3
|
def transaction_id
|
4
4
|
refunded_payment&.payment_uuid
|
@@ -9,7 +9,7 @@ class WxpayRefund < Refund
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def do_refund(params = {})
|
12
|
-
|
12
|
+
_params = {
|
13
13
|
out_refund_no: self.refund_uuid,
|
14
14
|
total_fee: (payment.total_amount * 100).to_i,
|
15
15
|
refund_fee: (total_amount * 100).to_i,
|
@@ -17,24 +17,32 @@ class WxpayRefund < Refund
|
|
17
17
|
}
|
18
18
|
|
19
19
|
begin
|
20
|
-
result = WxPay::Service.invoke_refund(
|
20
|
+
result = WxPay::Service.invoke_refund(_params)
|
21
21
|
if result['result_code'] == 'SUCCESS'
|
22
|
-
self.
|
22
|
+
self.state = 'completed'
|
23
|
+
order.payment_status = 'refunded'
|
24
|
+
self.refunded_at = Time.now
|
23
25
|
else
|
24
|
-
self.
|
26
|
+
self.state = 'failed'
|
27
|
+
self.comment = result['result_code']
|
25
28
|
end
|
26
29
|
rescue StandardError => e
|
27
|
-
|
28
|
-
self.
|
30
|
+
self.state = 'failed'
|
31
|
+
self.comment = e.message.truncate(225)
|
32
|
+
ensure
|
33
|
+
self.class.transaction do
|
34
|
+
self.save!
|
35
|
+
order.save!
|
36
|
+
end
|
29
37
|
end
|
30
|
-
|
38
|
+
self
|
31
39
|
end
|
32
40
|
|
33
41
|
def refund_query
|
34
42
|
params = {
|
35
43
|
out_refund_no: self.refund_uuid
|
36
44
|
}
|
37
|
-
|
45
|
+
WxPay::Service.refund_query(params)
|
38
46
|
end
|
39
47
|
|
40
48
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RailsTrade::Sell
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
include RailsTrade::Good
|
6
|
+
attribute :buyer_type, :string
|
7
|
+
attribute :buyer_id, :integer
|
8
|
+
|
9
|
+
belongs_to :buyer, polymorphic: true, optional: true
|
10
|
+
|
11
|
+
has_one :order_item, as: :good, dependent: :nullify
|
12
|
+
has_one :order, ->(o){ where(buyer_type: o.buyer.class.name, buyer_id: o.buyer.id) }, through: :order_item
|
13
|
+
end
|
14
|
+
|
15
|
+
def update_order
|
16
|
+
order_item.update amount: self.price
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_order
|
20
|
+
return @get_order if defined?(@get_order)
|
21
|
+
@get_order = self.order || generate_order!(buyer: self.buyer, number: 1)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
module RailsTrade::TradeItem
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
included do
|
4
|
+
attribute :status, :string, default: 'checked'
|
5
|
+
attribute :myself, :boolean, default: true, comment: '是否后台协助添加'
|
6
|
+
attribute :starred, :boolean, default: false, comment: '收藏'
|
7
|
+
attribute :good_name, :string
|
8
|
+
attribute :number, :integer, default: 1
|
9
|
+
attribute :weight, :decimal, default: 0, comment: '重量'
|
10
|
+
attribute :unit, :string, comment: '单位'
|
11
|
+
attribute :single_price, :decimal, default: 0, comment: '一份产品的价格'
|
12
|
+
attribute :original_amount, :decimal, default: 0, comment: '合计份数之后的价格,商品原价'
|
13
|
+
attribute :additional_amount, :decimal, default: 0, comment: '附加服务价格汇总'
|
14
|
+
attribute :reduced_amount, :decimal, default: 0, comment: '已优惠的价格'
|
15
|
+
attribute :retail_price, :decimal, default: 0, comment: '单个商品零售价(商品原价 + 服务价)'
|
16
|
+
attribute :wholesale_price, :decimal, default: 0, comment: '多个商品批发价'
|
17
|
+
attribute :amount, :decimal, default: 0
|
18
|
+
attribute :note, :string
|
19
|
+
attribute :advance_amount, :decimal, default: 0
|
20
|
+
attribute :extra, :json, default: {}
|
21
|
+
|
22
|
+
belongs_to :good, polymorphic: true
|
23
|
+
belongs_to :trade, polymorphic: true, inverse_of: :trade_items, counter_cache: true
|
24
|
+
has_many :trade_promotes, -> { includes(:promote).single }, inverse_of: :trade_item, dependent: :destroy
|
25
|
+
#has_many :organs, dependent: :delete_all 用于对接供应商
|
26
|
+
|
27
|
+
scope :valid, -> { where(status: 'init', myself: true) }
|
28
|
+
scope :starred, -> { where(status: 'init', starred: true) }
|
29
|
+
|
30
|
+
enum status: {
|
31
|
+
init: 'init',
|
32
|
+
checked: 'checked',
|
33
|
+
ordered: 'ordered',
|
34
|
+
done: 'done',
|
35
|
+
canceled: 'canceled'
|
36
|
+
}
|
37
|
+
|
38
|
+
after_initialize if: :new_record? do
|
39
|
+
if good
|
40
|
+
self.good_name = good.name
|
41
|
+
self.single_price = good.price
|
42
|
+
end
|
43
|
+
end
|
44
|
+
after_update :sync_changed_amount, if: -> { (saved_changes.keys & ['amount', 'additional_amount', 'reduced_amount']).present? }
|
45
|
+
after_commit :sync_cart_charges, :total_cart_charges, if: -> { number_changed? }, on: [:create, :update]
|
46
|
+
end
|
47
|
+
|
48
|
+
def original_quantity
|
49
|
+
good.unified_quantity * self.number
|
50
|
+
end
|
51
|
+
|
52
|
+
# 批发价和零售价之间的差价,即批发折扣
|
53
|
+
def discount_price
|
54
|
+
wholesale_price - (retail_price * number)
|
55
|
+
end
|
56
|
+
|
57
|
+
def init_amount
|
58
|
+
self.original_amount = single_price * number
|
59
|
+
self.advance_amount = good.advance_price
|
60
|
+
self.amount = original_amount
|
61
|
+
trade.item_amount += amount
|
62
|
+
trade.amount += amount
|
63
|
+
end
|
64
|
+
|
65
|
+
def compute_promote
|
66
|
+
good.valid_promote_goods.map do |promote_good|
|
67
|
+
value = metering_attributes.fetch(promote_good.promote.metering)
|
68
|
+
promote_charge = promote_good.promote.compute_charge(value, **extra)
|
69
|
+
next unless promote_charge
|
70
|
+
if promote_good.promote.single?
|
71
|
+
tp = self.trade_promotes.build(promote_charge_id: promote_charge.id, promote_good_id: promote_good.id)
|
72
|
+
else
|
73
|
+
tp = trade.trade_promotes.build(promote_charge_id: promote_charge.id, promote_good_id: promote_good.id)
|
74
|
+
end
|
75
|
+
tp.compute_amount
|
76
|
+
end
|
77
|
+
|
78
|
+
return unless trade.buyer
|
79
|
+
trade.buyer.promote_buyers.each do |promote_buyer|
|
80
|
+
value = metering_attributes.fetch(promote_buyer.promote.metering)
|
81
|
+
promote_charge = promote_buyer.promote.compute_charge(value, **extra)
|
82
|
+
next unless promote_charge
|
83
|
+
if promote_good.promote.single?
|
84
|
+
tp = self.trade_promotes.build(promote_charge_id: promote_charge.id, promote_buyer_id: promote_buyer.id, promote_good_id: promote_buyer.promote_good_id)
|
85
|
+
else
|
86
|
+
tp = trade.trade_promotes.build(promote_charge_id: promote_charge.id, promote_buyer_id: promote_buyer.id, promote_good_id: promote_buyer.promote_good_id)
|
87
|
+
end
|
88
|
+
tp.compute_amount
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def sum_amount
|
93
|
+
self.additional_amount = trade_promotes.select(&->(o){ o.amount >= 0 }).sum(&:amount)
|
94
|
+
self.reduced_amount = trade_promotes.select(&->(o){ o.amount < 0 }).sum(&:amount) # 促销价格
|
95
|
+
|
96
|
+
self.retail_price = single_price + additional_amount
|
97
|
+
self.wholesale_price = original_amount + additional_amount
|
98
|
+
|
99
|
+
self.amount = original_amount + additional_amount + reduced_amount # 最终价格
|
100
|
+
self
|
101
|
+
end
|
102
|
+
|
103
|
+
def sync_changed_amount
|
104
|
+
self.amount = original_amount + additional_amount + reduced_amount
|
105
|
+
|
106
|
+
changed_amount = amount - amount_before_last_save
|
107
|
+
trade.item_amount += changed_amount
|
108
|
+
trade.amount += changed_amount
|
109
|
+
if trade.amount == trade.compute_saved_amount
|
110
|
+
trade.save!
|
111
|
+
else
|
112
|
+
trade.errors.add :amount, 'not equal'
|
113
|
+
logger.error "#{self.class.name}/#{trade.class.name}: #{trade.error_text}"
|
114
|
+
raise ActiveRecord::RecordInvalid.new(trade)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def reset_amount
|
119
|
+
self.additional_amount = trade_promotes.default_where('amount-gte': 0).sum(:amount)
|
120
|
+
self.reduced_amount = trade_promotes.default_where('amount-lt': 0).sum(:amount)
|
121
|
+
self.amount = original_amount + additional_amount + reduced_amount
|
122
|
+
self.valid?
|
123
|
+
self.changes
|
124
|
+
end
|
125
|
+
|
126
|
+
def reset_amount!
|
127
|
+
self.reset_amount
|
128
|
+
self.update_columns changes.transform_values(&->(o){ o[1] })
|
129
|
+
end
|
130
|
+
|
131
|
+
def valid_promote_buyers(buyer)
|
132
|
+
ids = (available_promote_ids & buyer.all_promote_ids) - buyer.promote_buyers.pluck(:promote_id)
|
133
|
+
Promote.where(id: ids)
|
134
|
+
end
|
135
|
+
|
136
|
+
def metering_attributes
|
137
|
+
attributes.slice 'quantity', 'amount', 'number'
|
138
|
+
end
|
139
|
+
|
140
|
+
def confirm_ordered!
|
141
|
+
self.good.order_done
|
142
|
+
end
|
143
|
+
|
144
|
+
def confirm_paid!
|
145
|
+
end
|
146
|
+
|
147
|
+
def confirm_part_paid!
|
148
|
+
end
|
149
|
+
|
150
|
+
def confirm_refund!
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module RailsTrade::TradePromote
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
included do
|
4
|
+
attribute :sequence, :integer
|
5
|
+
attribute :scope, :string
|
6
|
+
attribute :original_amount, :decimal, comment: '初始价格'
|
7
|
+
attribute :based_amount, :decimal, precision: 10, scale: 2, default: 0, comment: '基于此价格计算,默认为 trade_item 的 amount,与sequence有关'
|
8
|
+
attribute :computed_amount, :decimal, precision: 10, scale: 2, default: 0, comment: '计算出的价格'
|
9
|
+
attribute :amount, :decimal, precision: 10, scale: 2, default: 0, comment: '默认等于 computed_amount,如果客服人员修改过价格后,则 amount 会发生变化'
|
10
|
+
attribute :note, :string, comment: '备注'
|
11
|
+
|
12
|
+
belongs_to :trade, polymorphic: true, inverse_of: :trade_promotes
|
13
|
+
belongs_to :trade_item, optional: true
|
14
|
+
belongs_to :promote
|
15
|
+
belongs_to :promote_charge
|
16
|
+
belongs_to :promote_good
|
17
|
+
belongs_to :promote_buyer, counter_cache: true, optional: true
|
18
|
+
|
19
|
+
validates :promote_id, uniqueness: { scope: [:trade_type, :trade_id, :trade_item_id] }
|
20
|
+
validates :amount, presence: true
|
21
|
+
|
22
|
+
enum scope: {
|
23
|
+
single: 'single',
|
24
|
+
overall: 'overall'
|
25
|
+
}
|
26
|
+
|
27
|
+
after_initialize if: :new_record? do
|
28
|
+
if trade_item
|
29
|
+
self.trade = trade_item.trade
|
30
|
+
end
|
31
|
+
if self.promote_good
|
32
|
+
self.promote_id = self.promote_good.promote_id
|
33
|
+
self.sequence = self.promote.sequence
|
34
|
+
self.scope = self.promote.scope
|
35
|
+
end
|
36
|
+
end
|
37
|
+
after_update :sync_changed_amount, if: -> { saved_change_to_amount? }
|
38
|
+
after_create_commit :check_promote_buyer
|
39
|
+
end
|
40
|
+
|
41
|
+
def compute_amount
|
42
|
+
if single?
|
43
|
+
value = trade_item.metering_attributes.fetch(promote.metering, 0)
|
44
|
+
added_amount = trade_item.trade_promotes.select { |cp| cp.promote.sequence < self.promote.sequence }.sum(&->(o){ o.send(promote.metering) })
|
45
|
+
|
46
|
+
self.based_amount = value + added_amount
|
47
|
+
else
|
48
|
+
value = trade.metering_attributes.fetch(promote.metering, 0)
|
49
|
+
added_amount = trade.trade_promotes.select { |cp| cp.promote.sequence < self.promote.sequence }.sum(&->(o){ o.send(promote.metering) })
|
50
|
+
|
51
|
+
self.based_amount = value + added_amount
|
52
|
+
end
|
53
|
+
|
54
|
+
self.computed_amount = self.promote_charge.final_price(based_amount)
|
55
|
+
self.amount = computed_amount if amount.zero?
|
56
|
+
self
|
57
|
+
end
|
58
|
+
|
59
|
+
def sync_changed_amount
|
60
|
+
if amount >= 0 && amount_before_last_save >= 0
|
61
|
+
_additional_amount = amount - amount_before_last_save
|
62
|
+
_reduced_amount = 0
|
63
|
+
elsif amount >= 0 && amount_before_last_save < 0
|
64
|
+
_additional_amount = amount
|
65
|
+
_reduced_amount = -amount_before_last_save
|
66
|
+
elsif amount < 0 && amount_before_last_save >= 0
|
67
|
+
_additional_amount = -amount_before_last_save
|
68
|
+
_reduced_amount = amount
|
69
|
+
else # amount < 0 && amount_before_last_save < 0
|
70
|
+
_additional_amount = 0
|
71
|
+
_reduced_amount = amount - amount_before_last_save
|
72
|
+
end
|
73
|
+
|
74
|
+
if overall?
|
75
|
+
trade.overall_additional_amount += _additional_amount
|
76
|
+
trade.overall_reduced_amount += _reduced_amount
|
77
|
+
trade.amount += (_additional_amount + _reduced_amount)
|
78
|
+
trade.save!
|
79
|
+
elsif single?
|
80
|
+
trade_item.additional_amount += _additional_amount
|
81
|
+
trade_item.reduced_amount += _reduced_amount
|
82
|
+
trade_item.amount += (_additional_amount + _reduced_amount)
|
83
|
+
trade_item.save!
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def check_promote_buyer
|
88
|
+
return unless promote_buyer
|
89
|
+
self.promote_buyer.update state: 'used'
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|