From 70b2d83682644ab826ebd8b11afe6446423444ec Mon Sep 17 00:00:00 2001 From: pushuo Date: Fri, 30 Dec 2022 15:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E5=89=8D=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E9=A1=B5=E5=92=8C?= =?UTF-8?q?=E7=BB=93=E8=B4=A6=E9=A1=B5=E6=8F=92=E4=BB=B6=20html=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=92=E5=85=A5=E7=82=B9=E3=80=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=9C=B0=E5=9D=80=E7=AE=A1=E7=90=86=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Shop/Http/Resources/ProductSimple.php | 2 +- .../admin/views/pages/orders/form.blade.php | 4 + .../beike/shop/default/css/page-checkout.scss | 30 +- .../beike/shop/default/css/product-style.scss | 5 +- themes/default/account/address.blade.php | 128 +---- themes/default/account/order_info.blade.php | 6 +- themes/default/checkout.blade.php | 539 ++++++++---------- themes/default/layout/header.blade.php | 4 +- themes/default/shared/address-form.blade.php | 243 ++++++-- 9 files changed, 472 insertions(+), 489 deletions(-) diff --git a/beike/Shop/Http/Resources/ProductSimple.php b/beike/Shop/Http/Resources/ProductSimple.php index 841e6958..02cca8b0 100644 --- a/beike/Shop/Http/Resources/ProductSimple.php +++ b/beike/Shop/Http/Resources/ProductSimple.php @@ -41,7 +41,7 @@ class ProductSimple extends JsonResource 'id' => $this->id, 'sku_id' => $masterSku->id, 'name' => $name, - 'name_format' => sub_string($name, 36), + 'name_format' => $name, 'url' => shop_route('products.show', ['product' => $this]), 'price' => $masterSku->price, 'origin_price' => $masterSku->origin_price, diff --git a/resources/beike/admin/views/pages/orders/form.blade.php b/resources/beike/admin/views/pages/orders/form.blade.php index e8bdf01c..645ab940 100644 --- a/resources/beike/admin/views/pages/orders/form.blade.php +++ b/resources/beike/admin/views/pages/orders/form.blade.php @@ -89,6 +89,10 @@ + @foreach ($html_items as $item) + {!! $item !!} + @endforeach + @can('orders_update_status')
{{ __('order.order_status') }}
diff --git a/resources/beike/shop/default/css/page-checkout.scss b/resources/beike/shop/default/css/page-checkout.scss index e2a25867..aabf99f4 100644 --- a/resources/beike/shop/default/css/page-checkout.scss +++ b/resources/beike/shop/default/css/page-checkout.scss @@ -15,17 +15,45 @@ body.page-checkout { align-items: center; cursor: pointer; padding: 20px; + border: 1px solid transparent; &:not(:last-of-type) { margin-bottom: 1rem; } &:hover { + border-color: #e5e5e5; + } + &:active { + background-color: #f7f7f7; } &.active { - border: 1px solid #e5e5e5; + border-color: #e5e5e5; + + .radio { + border-color: $primary; + + &:before { + content: ''; + position: absolute; + width: 12px; + height: 12px; + background-color: $primary; + left: 2px; + top: 2px; + border-radius: 50%; + } + } + } + + .radio { + position: relative; + width: 18px; + height: 18px; + border: 1px solid #d4d4d4; + border-radius: 50%; } .left { diff --git a/resources/beike/shop/default/css/product-style.scss b/resources/beike/shop/default/css/product-style.scss index a8400325..78a81130 100644 --- a/resources/beike/shop/default/css/product-style.scss +++ b/resources/beike/shop/default/css/product-style.scss @@ -51,10 +51,12 @@ } .product-name { - margin-bottom: 6px; + height: 39px; + margin-bottom: 10px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; + color: #3d3d3d; -webkit-box-orient: vertical; -webkit-line-clamp: 2; } @@ -62,6 +64,7 @@ .product-price { .price-new { color: $primary; + font-size: 1.1rem; font-weight: bold; } diff --git a/themes/default/account/address.blade.php b/themes/default/account/address.blade.php index b23d98ed..1a77b6bd 100644 --- a/themes/default/account/address.blade.php +++ b/themes/default/account/address.blade.php @@ -40,7 +40,7 @@ v-if="address.default">{{ __('shop/account.addresses.default_address') }}
{{ __('shop/account.addresses.delete') }} - {{ __('shop/account.addresses.edit') }} + {{ __('shop/account.addresses.edit') }}
@@ -57,88 +57,35 @@ - @include('shared.address-form', [ - 'address_form_key' => 'form', - 'address_form_show' => 'editShow', - 'address_form_rules' => 'rules', - ]) + @endsection @push('add-scripts') + @include('shared.address-form') + + $http.post('/checkout/confirm').then((res) => { + location = 'orders/' + res.number + '/success?type=create' + }) + }); + }); + + var app = new Vue({ + el: '#checkout-app', + + data: { + form: { + shipping_address_id: @json($current['shipping_address_id']), + payment_address_id: @json($current['payment_address_id']), + }, + + isAllAddress: false, + isAllAddressPayment: false, + + source: { + addresses: @json($addresses ?? []), + }, + + dialogAddress: { + index: null, + type: 'shipping_address_id', + }, + }, + + computed: { + same_as_shipping_address: { + get() { + return this.form.shipping_address_id == this.form.payment_address_id + }, + + set(e) { + if (e) { + this.form.payment_address_id = this.form.shipping_address_id + this.updateCheckout(this.form.payment_address_id, 'same_as_shipping_address') + } else { + this.form.payment_address_id = ''; + } + } + }, + }, + + methods: { + editAddress(index, type) { + let addresses = null + + if (typeof index == 'number') { + this.dialogAddress.index = index; + + addresses = JSON.parse(JSON.stringify(this.source.addresses[index])) + } + + this.dialogAddress.type = type + this.$refs['address-dialog'].editAddress(addresses) + }, + + onAddressDialogChange(form) { + if (this.source.addresses.find(e => e.id == form.id)) { + this.source.addresses[this.dialogAddress.index] = form + } else { + this.source.addresses.push(form) + this.updateCheckout(form.id, this.dialogAddress.type) + this.form[this.dialogAddress.type] = form.id + } + + this.dialogAddress.index = null; + this.$forceUpdate() + }, + + updateCheckout(id, key) { + if (this.form[key] === id && key != 'same_as_shipping_address') { + return + } + + if (key == 'shipping_address_id' && this.same_as_shipping_address) { + this.form.payment_address_id = id + } + + this.form[key] = id + + $http.put('/checkout', this.form).then((res) => { + this.form = res.current + this.source.totals = res.totals + + this.isAllAddress = false + this.isAllAddressPayment = false + }) + }, + } + }) + @endpush diff --git a/themes/default/layout/header.blade.php b/themes/default/layout/header.blade.php index 3d2304fd..b833589f 100644 --- a/themes/default/layout/header.blade.php +++ b/themes/default/layout/header.blade.php @@ -81,7 +81,7 @@
{{ current_customer()->name }}
  • - +
  • {{ __('shop/account.index') }}
  • @@ -90,7 +90,7 @@
  • {{ __('shop/account.wishlist.index') }}
  • - +
  • {{ __('common.sign_out') }}
  • diff --git a/themes/default/shared/address-form.blade.php b/themes/default/shared/address-form.blade.php index 6f95bef4..e37c101e 100644 --- a/themes/default/shared/address-form.blade.php +++ b/themes/default/shared/address-form.blade.php @@ -1,62 +1,183 @@ -@php - $address_form_show = $address_form_show ?? 'dialogAddress.show'; - $address_form_key = $address_form_key ?? 'dialogAddress.form'; - $address_form_rules = $address_form_rules ?? 'addressRules'; -@endphp + - - - - - - - - - -
    -
    - - - - - - -
    -
    - - - - - - -
    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - {{ __('common.save') }} - {{ __('common.cancel') }} - -
    -
    \ No newline at end of file + \ No newline at end of file