Commit 3e1e2841 by dhn

修改优化购物流程

parent b45ed34b
......@@ -15,8 +15,13 @@ class Failure extends \Magento\Checkout\Controller\Onepage
{
$lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
$lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
if(!$lastQuoteId && !$lastOrderId && isset($_REQUEST['order_sn']))
{
$order = $objectManager->create('Magento\Sales\Model\OrderFactory')->create()->loadByIncrementId($_REQUEST['order_sn']);
$lastOrderId = $order->getId();
$lastQuoteId = $order->getQuoteId();
}
$quote = $objectManager->create('Magento\Quote\Model\QuoteFactory')->create()->load($lastQuoteId);
$quote->setReservedOrderId(null);
......
......@@ -30,6 +30,7 @@ define([
shippingAddress = ko.observable(null),
shippingMethod = ko.observable(null),
paymentMethod = ko.observable(null),
paymentMethodlist = ko.observable(null),
quoteData = window.checkoutConfig.quoteData,
basePriceFormat = window.checkoutConfig.basePriceFormat,
priceFormat = window.checkoutConfig.priceFormat,
......@@ -44,6 +45,7 @@ define([
shippingMethod: shippingMethod,
billingAddress: billingAddress,
paymentMethod: paymentMethod,
paymentMethodlist:paymentMethodlist,
guestEmail: null,
/**
......@@ -111,7 +113,12 @@ define([
getPaymentMethod: function () {
return paymentMethod;
},
setPaymentMethodList: function (MethodList) {
paymentMethodlist(MethodList);
},
getPaymentMethodList: function () {
return paymentMethodlist;
},
/**
* @return {*}
*/
......
......@@ -58,6 +58,7 @@ define([
).done(
function (response) {
quote.setTotals(response.totals);
quote.setPaymentMethodList(methodConverter(response['payment_methods']));
paymentService.setPaymentMethods(methodConverter(response['payment_methods']));
fullScreenLoader.stopLoader();
}
......
......@@ -60,7 +60,7 @@ define([
/** @inheritdoc */
initObservable: function () {
this._super().
observe(['paymentGroupsList']);
observe(['paymentGroupsList']);
return this;
},
......@@ -241,10 +241,13 @@ define([
return isShow;
},
getBillingAddressRegionName: function(){
if(quote.paymentMethod())
return 'billing-address-form-'+quote.paymentMethod().method;
else
return 'billing-address-form-checkmo';
var _mList = quote.paymentMethodlist();
var _method = 'checkmo';
for(var i in _mList)
{
_method = _mList[i].method;
}
return 'billing-address-form-'+_method;
}
});
});
......@@ -5,25 +5,33 @@
*/
-->
<div if="isAddressDetailsVisible() && currentBillingAddress()" class="billing-address-details">
<text args="currentBillingAddress().prefix"></text> <text args="currentBillingAddress().firstname"></text>
<text args="currentBillingAddress().middlename"></text>
<text args="currentBillingAddress().lastname"></text> <text args="currentBillingAddress().suffix"></text><br/>
<text args="currentBillingAddress().street.join(', ')"></text><br/>
<text args="currentBillingAddress().city "></text>, <span text="currentBillingAddress().region"></span>
<text args="currentBillingAddress().postcode"></text><br/>
<text args="getCountryName(currentBillingAddress().countryId)"></text><br/>
<a if="currentBillingAddress().telephone" attr="'href': 'tel:' + currentBillingAddress().telephone" text="currentBillingAddress().telephone"></a><br/>
<div class="billing-box">
<div class="billing-address-box">
<text args="currentBillingAddress().prefix"></text> <text args="currentBillingAddress().firstname"></text>
<text args="currentBillingAddress().middlename"></text>
<text args="currentBillingAddress().lastname"></text> <text args="currentBillingAddress().suffix"></text><br/>
<text args="currentBillingAddress().street.join(', ')"></text><br/>
<text args="currentBillingAddress().city "></text>, <span text="currentBillingAddress().region"></span>
<text args="currentBillingAddress().postcode"></text><br/>
<text args="getCountryName(currentBillingAddress().countryId)"></text><br/>
<a if="currentBillingAddress().telephone" attr="'href': 'tel:' + currentBillingAddress().telephone" text="currentBillingAddress().telephone"></a><br/>
<each args="data: currentBillingAddress().customAttributes, as: 'element'">
<text args="$parent.getCustomAttributeLabel(element)"></text>
<br/>
</each>
<button visible="!isAddressSameAsShipping()"
type="button"
class="action action-edit-address"
click="editAddress">
<span translate="'Edit'"></span>
</button>
<each args="data: currentBillingAddress().customAttributes, as: 'element'">
<text args="$parent.getCustomAttributeLabel(element)"></text>
<br/>
</each>
</div>
<div class="billing-handle">
<button visible="!isAddressSameAsShipping()"
type="button"
class="action action-edit-address"
click="editAddress">
<span translate="'Edit'"></span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M19.769 9.923l-12.642 12.639-7.127 1.438 1.438-7.128 12.641-12.64 5.69 5.691zm1.414-1.414l2.817-2.82-5.691-5.689-2.816 2.817 5.69 5.692z"></path>
</svg>
</button>
</div>
</div>
</div>
<style>
.billing-box{
width: 50%;
padding: 20px 22px;
border: 1px solid #d6d6d6;
font-size: 14px;
min-height: 200px;
position: relative;
box-sizing: border-box;
}
.billing-address-box{
padding-bottom: 1rem;
border-bottom: 1px dashed #ddd;
}
.billing-handle .action-edit-address {
border: none;
background: 0 0;
position: absolute;
bottom: 0;
right: 10px;
outline: none;
text-align: center;
box-sizing: border-box;
}
.billing-handle .action-edit-address svg {
width: 12px;
height: 12px;
fill: #666;
}
.billing-address-details {
padding: 0.5rem 0px 0.5rem 1.5rem;
}
@media (max-width: 1023px){
.action-update-cancel{
height: 120px;
......@@ -9,8 +42,40 @@
margin-right: 20%;
}
}
@media (min-width: 768px) {
.billing-box:before {
width: 5px;
height: 100%;
display: block;
content: "";
position: absolute;
left: 0;
top: 0;
background-size: contain;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAACECAYAAABVnZHfAAAA+0lEQVQ4je3UsUrDUBTG8X9s6yZOeYMOLejgS7iIUDCrS0uH0oI+QUGdHZSsjnZw6dB3ENK1U8eCQqBjoWvkaE/4SpHgYjv0bj9yc5J7v3tukN5GGT9jcICMreFDEQFLRwK0gCyIXtLvKfGkd5aDwr+uKkbAsaMGvAElf+cc6GuB6m7szo4hU9w5ysA9UNdpTWDsS7BMn3U9mZ3EtdIlxZOiC3T8O6yeTr1axU7JPp8iJIor7zvDJ9CwjLTNwj+02aEiVrSBGyS5R03OEr/e51OEd4UFNXPMgUtgkTdT7zQONzrrd1woXoETh92UQyD0AnaXPmi1o3/ZA+ALpYA1JaK/rAEAAAAASUVORK5CYII=) repeat-y;
}
}
@media (max-width: 768px){
.billing-box{
width: 100%;
}
.billing-address-details {
padding: 0;
}
.billing-box:before{
width: 100%;
height: 5px;
bottom: 0;
left:0;
display: block;
content: "";
position: absolute;
background-size: contain;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAAAGCAYAAACclRsMAAABWklEQVR4nO3aMUrEQBiG4VfxAnoHwWZ7e1GsrAQ9gkIKDxPQI2hrJSvb29sIXsBKLyAoWbbLDCZuZvlD3qfaIgn59vsnTDFbHzfnP5TxBVxWs3re8em7wD1wUuh9SlnmBOb1azWJnD3uGXVWZ7dlKrM7+pzVrO56j7Mb26Rm129ui/uF+DY+uzuF/pJ34Kya1W8dr98HHoGDQu9TyjInYM62UWd1dlvMGdvk1qidtvjNjc25zXN2e9geMsHKAjjsUdoR8DLCwsyZZ6exmTPNNRqfnaaZMzZz5tlpT0Nv3O+AU+Cz4/VXwBOwN/B7lGbOPDuNzZxprtH47DTNnLGZM89O/2Gojfs30BzYul79/ktzRKc5hHlb8LhOCebMs9PYzJnmGo3PTtPMGZs58+x0DUM8qDmYfwE8d7y+OZj/ABwPFWJDzJlnp7GZM801Gp+dppkzNnPm2ek6gF8O5wurSKfLHQAAAABJRU5ErkJggg==) repeat-x;
}
}
</style>
<div class="checkout-billing-address">
<div class="checkout-billing-address cclt">
<div class="billing-address-same-as-shipping-block field choice" data-bind="visible: canUseShippingAddress()">
<input type="checkbox" name="billing-address-same-as-shipping"
......
......@@ -9,7 +9,7 @@
<div repeat="foreach: paymentGroupsList, item: '$group'"
class="payment-group">
<!-- ko if: showFormShared($group) -->
<!-- ko foreach: getRegion('billing-address-form-free') -->
<!-- ko foreach: getRegion(getBillingAddressRegionName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!--/ko-->
......
......@@ -134,7 +134,7 @@ class Back extends \Magento\Framework\App\Action\Action implements CsrfAwareActi
break;
case 2:
//在网站中已经是支付成功
$url = 'checkout/onepage/success';
$url = 'checkout/onepage/success';
break;
case '10000':
//10000:Payment is declined 高风险订单
......@@ -157,10 +157,8 @@ class Back extends \Magento\Framework\App\Action\Action implements CsrfAwareActi
default:
}
$url = $this->urlBuilder->getUrl($url);
$this->getParentLocationReplace($url);
$url = $this->urlBuilder->getUrl($url.'?order_sn='.$_REQUEST['order_number']);
$this->getParentLocationReplace(trim($url,'/'));
}
......
......@@ -733,6 +733,9 @@ p.shopbycate-title {
cursor:pointer;
color: #0000ff;
}
.checkout-cart-index #maincontent .columns #block-shipping{
margin-top:0;
}
.checkout-cart-index .col.qty{
text-align: center;
}
......@@ -819,9 +822,7 @@ p.shopbycate-title {
border-bottom: 1px solid #ddd;
}
.checkout-cart-index .cart-container .cart-summary {
gap: 0px;
}
.checkout-cart-index .column.main .block .title {
padding: 0.6rem 1rem;
}
......@@ -835,10 +836,16 @@ p.shopbycate-title {
background-color: #ffffff;
}
}
.checkout-cart-index .cart-container .cart-summary {
gap: 0px;
}
@media (max-width: 768px){
.checkout-cart-index .cart-container .cart-summary {
margin:0;
}
.checkout-cart-index .cart-container .cart-summary > .title {
padding: 1rem 0px;
}
}
.checkout-index-index .details-qty,.checkout-cart-index .details-qty{
display: block;
......
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