From 21e89dea55de3f8a5cb5ada4a7cd8817bc35f0f5 Mon Sep 17 00:00:00 2001 From: Wayne Date: Thu, 29 Jun 2023 02:31:19 +0000 Subject: [PATCH] 0000512 --- .devcontainer/Dockerfile | 20 ++++++++++++++++++++ .devcontainer/devcontainer.json | 10 ++++++++++ Dockerfile | 9 +++++++++ src/pages/Cart/Checkout.vue | 20 +++++++++++++++----- src/pages/Cart/Shipping.vue | 2 +- 5 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..3ec9738 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,20 @@ +FROM node:20-alpine3.17 + +# Install basic development tools +# RUN apt update \ +# && apt install -y less sudo \ +# && apt install -y php \ +# && php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ +# && php composer-setup.php \ +# && php -r "unlink('composer-setup.php');" \ +# && mv composer.phar /usr/local/bin/composer + + +# # Ensure default `node` user has access to `sudo` +# ARG USERNAME=node +# RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ +# && chmod 0440 /etc/sudoers.d/$USERNAME +WORKDIR /app + +# Set `DEVCONTAINER` environment variable to help with orientation +ENV DEVCONTAINER=true diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..58875c9 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +// See https://containers.dev/implementors/json_reference/ for configuration reference +{ + "name": "Slash Shop H5 Dev", + "build": { + "dockerfile": "Dockerfile" + }, + "workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind", + "workspaceFolder": "/app", + "remoteUser": "root" +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f51d63c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +### Dockerfile in shop-h5 +FROM node:20-alpine3.17 +# make the 'app' folder the current working directory +WORKDIR /app +# copy both 'package.json' and 'package-lock.json' (if available) +COPY package*.json ./ +# install project dependencies +RUN npm install +EXPOSE 8080 #容器建立後,其預設開啟 8080 對外 \ No newline at end of file diff --git a/src/pages/Cart/Checkout.vue b/src/pages/Cart/Checkout.vue index 64d0344..03dca76 100644 --- a/src/pages/Cart/Checkout.vue +++ b/src/pages/Cart/Checkout.vue @@ -421,11 +421,6 @@ const showCod = ref(false) const selectShipping = async (value) => { if (shippingData.value.shipping_code === value.shipping_code) return; - if(value.support_cod === 1){ - showCod.value = true - }else{ - showCod.value = false - } switch (value.shipping_code) { case "shipping": let resAddr = await getUserDefaultAddress(); @@ -434,6 +429,7 @@ const selectShipping = async (value) => { orderStore.shipping = { shipping_code: value.shipping_code, shipping_id: value.shipping_id, + support_cod: value.support_cod, shipping_fee: 0, extra_data: { zipcode: resAddr.data.zipcode, @@ -448,6 +444,7 @@ const selectShipping = async (value) => { orderStore.shipping = { shipping_code: value.shipping_code, shipping_id: value.shipping_id, + support_cod: value.support_cod, shipping_fee: 0, extra_data: {}, }; @@ -461,6 +458,7 @@ const selectShipping = async (value) => { shipping_code: value.shipping_code, shipping_id: value.shipping_id, shipping_fee: 0, + support_cod: value.support_cod, extra_data: { type: res.data.type, store_id: res.data.store_id, @@ -473,6 +471,7 @@ const selectShipping = async (value) => { orderStore.shipping = { shipping_code: value.shipping_code, shipping_id: value.shipping_id, + support_cod: value.support_cod, shipping_fee: 0, extra_data: {}, }; @@ -484,6 +483,17 @@ const selectShipping = async (value) => { } }; +watch(()=>orderStore.shipping,(value)=>{ + console.log('va',value) + if(value.support_cod === 1){ + showCod.value = true + }else{ + showCod.value = false + } +},{ + immediate: true +}) + const changeShipping = () => { switch (shippingData.value.shipping_code) { case "ecpay": diff --git a/src/pages/Cart/Shipping.vue b/src/pages/Cart/Shipping.vue index 1fbbf3f..0871c62 100644 --- a/src/pages/Cart/Shipping.vue +++ b/src/pages/Cart/Shipping.vue @@ -112,6 +112,7 @@ onMounted(async () => { orderStore.shipping.shipping_code = res2.shipping_code; orderStore.shipping.shipping_id = res2.shipping_id; + orderStore.shipping.support_cod = res2.support_cod; orderStore.shipping.shipping_fee = 0; router.replace("/checkout"); } @@ -143,7 +144,6 @@ const handleDeleteLogistic = async (id) => { const handleGetMap = async (type) => { let res = await getMap({ type }); if (res.code === 200) { - console.log(formContainer.value); formContainer.value.innerHTML = res.data; if (showForm.value === "none") { formContainer.value.querySelector("form").submit();