diff --git a/.gitignore b/.gitignore index eb1e6137..37204823 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ pos data +fds diff --git a/h5/components.d.ts b/h5/components.d.ts index ea7cf035..5a801ec4 100644 --- a/h5/components.d.ts +++ b/h5/components.d.ts @@ -21,17 +21,12 @@ declare module '@vue/runtime-core' { VanCollapse: typeof import('vant/es')['Collapse'] VanCollapseItem: typeof import('vant/es')['CollapseItem'] VanDatePicker: typeof import('vant/es')['DatePicker'] - VanDialog: typeof import('vant/es')['Dialog'] VanField: typeof import('vant/es')['Field'] VanForm: typeof import('vant/es')['Form'] - VanGrid: typeof import('vant/es')['Grid'] - VanGridItem: typeof import('vant/es')['GridItem'] VanIcon: typeof import('vant/es')['Icon'] VanList: typeof import('vant/es')['List'] VanNavBar: typeof import('vant/es')['NavBar'] - VanOverlay: typeof import('vant/es')['Overlay'] VanPicker: typeof import('vant/es')['Picker'] - VanPopover: typeof import('vant/es')['Popover'] VanPopup: typeof import('vant/es')['Popup'] VanPullRefresh: typeof import('vant/es')['PullRefresh'] VanRadio: typeof import('vant/es')['Radio'] @@ -42,6 +37,5 @@ declare module '@vue/runtime-core' { VanSwitch: typeof import('vant/es')['Switch'] VanTab: typeof import('vant/es')['Tab'] VanTabs: typeof import('vant/es')['Tabs'] - VanUploader: typeof import('vant/es')['Uploader'] } } diff --git a/h5/index.html b/h5/index.html index 3b8d5f85..b89e731d 100644 --- a/h5/index.html +++ b/h5/index.html @@ -21,9 +21,7 @@ - - - + @@ -35,7 +33,7 @@
- + diff --git a/h5/package.json b/h5/package.json index 981a781a..7e04ec6f 100644 --- a/h5/package.json +++ b/h5/package.json @@ -24,6 +24,7 @@ "lodash": "^4.17.21", "nprogress": "^0.2.0", "pinia": "^2.0.28", + "pinia-plugin-persistedstate": "^3.1.0", "postcss": "^8.4.20", "qrcode.vue": "^3.4.0", "reconnecting-websocket": "^4.4.0", diff --git a/h5/src/components/Footer.vue b/h5/src/components/Footer.vue index 414a1c2a..1e6c1e82 100644 --- a/h5/src/components/Footer.vue +++ b/h5/src/components/Footer.vue @@ -10,7 +10,7 @@ diff --git a/h5/src/main.ts b/h5/src/main.js similarity index 100% rename from h5/src/main.ts rename to h5/src/main.js diff --git a/h5/src/pages/Card/Index.vue b/h5/src/pages/Card/Index.vue deleted file mode 100644 index faea4b29..00000000 --- a/h5/src/pages/Card/Index.vue +++ /dev/null @@ -1,474 +0,0 @@ - - - - - diff --git a/h5/src/pages/Card/compoments/CardData.vue b/h5/src/pages/Card/compoments/CardData.vue deleted file mode 100644 index e5eccd91..00000000 --- a/h5/src/pages/Card/compoments/CardData.vue +++ /dev/null @@ -1,274 +0,0 @@ - - - - - \ No newline at end of file diff --git a/h5/src/pages/Cart/Checkout.vue b/h5/src/pages/Cart/Checkout.vue index 5cd02be4..af3e3d6c 100644 --- a/h5/src/pages/Cart/Checkout.vue +++ b/h5/src/pages/Cart/Checkout.vue @@ -28,7 +28,7 @@ v-swiperight="(event) => handleSwipeRight(event, item)">
- offer + offer
{{ item.goods_name }} @@ -44,7 +44,7 @@
+ aria-controls="confirmation" @click="handleDeleteItem(item.goods_id)">
@@ -389,7 +389,7 @@ const handleDeleteItem = async (id) => { const changeItemNum = (item, num) => { if (item.goods_number + num <= 0) { - cartStore.delCart(item.rec_id); + cartStore.delCart(item.goods_id); } else { cartStore.updateCart(item, item.goods_number + num); } diff --git a/h5/src/pages/Cart/Index.vue b/h5/src/pages/Cart/Index.vue index 938c988c..fbefe529 100644 --- a/h5/src/pages/Cart/Index.vue +++ b/h5/src/pages/Cart/Index.vue @@ -41,7 +41,7 @@
+ aria-controls="confirmation" @click="handleDeleteItem(item.goods_id)">
@@ -106,7 +106,7 @@ const handleDeleteItem = async (id) => { const changeItemNum = (item, num) => { if (item.goods_number + num <= 0) { - cartStore.delCart(item.rec_id); + cartStore.delCart(item.goods_id); } else { cartStore.updateCart(item, item.goods_number + num); } @@ -114,7 +114,7 @@ const changeItemNum = (item, num) => { const changeInputNum = (item, num) => { if (num <= 0) { - cartStore.delCart(item.rec_id); + cartStore.delCart(item.goods_id); } else { cartStore.updateCart(item, num); } diff --git a/h5/src/pages/Category/Index.vue b/h5/src/pages/Category/Index.vue index e2b85fbe..5b407335 100644 --- a/h5/src/pages/Category/Index.vue +++ b/h5/src/pages/Category/Index.vue @@ -9,28 +9,18 @@ -
-
- 點餐類型: -
-
- {{ type }} -
-
-
-
- 桌號: -
-
- {{ cartStore.table_no }} -
-
-
-
- 地址: -
-
-
+
+ + + + +
@@ -70,8 +60,9 @@

${{ v.shop_price }}

- +
@@ -100,7 +91,7 @@ @@ -130,6 +121,8 @@ const cate_id = ref(1) const goods = ref({}) const goods_id = ref({}) +const goodsNumber = ref({}) + const showBottom = ref(false) const state = reactive( @@ -144,7 +137,7 @@ onMounted(async () => { if (route.query.type) { cartStore.type = parseInt(route.query.type) if (cartStore.type === 1) { - if(route.query.table_no){ + if (route.query.table_no) { cartStore.table_no = route.query.table_no } } @@ -191,15 +184,15 @@ const handleClickItem = async (cat_id) => { } } -const changeItemNum = (goods_id, num) => { +const changeItemNum = (goods, num) => { //用goods_id取得item - let item = cartItems.value[goods_id]; + let item = cartItems.value[goods.goods_id]; if (!item) { - return addToCart(goods_id, num); + return addToCart(goods, num); } if (item.goods_number + num <= 0) { - cartStore.delCart(item.rec_id); + cartStore.delCart(item.goods_id); } else { cartStore.updateCart(item, item.goods_number + num); } @@ -213,18 +206,23 @@ const cartTotal = computed(() => { }, 0); }) -const addToCart = async (id, num, type = 0) => { +const addToCart = async (goods, num, type = 0) => { + //上傳商品至購物車 - let goods = { - quick: 1, - spec: "", - goods_id: id, - number: num, - parent: 0, - cardInfo: "", + + let gs = { + add_info: '', + buymax: goods.buymax, + cat_id: goods.cat_id, + goods_id: goods.goods_id, + goods_name: goods.goods_name, + goods_number: 1, + goods_price: goods.shop_price, + goods_sn: goods.goods_sn, + goods_thumb: goods.goods_thumb }; - let res = await cartStore.addCart(goods); + let res = await cartStore.addCart(gs); if (!res) { return showToast("添加失敗!"); @@ -244,22 +242,47 @@ const handleShowGoods = (id) => { showBottom.value = true } +const handlePopupClose = (value) => { + goodsNumber.value[value.id] = value.num + showBottom.value = false +} + +const columns = [ + { text: '1', value: '1' }, + { text: '2', value: '2' }, + { text: '3', value: '3' }, + { text: '4', value: '4' }, + { text: '5', value: '5' }, +]; + +const fieldValue = ref(''); +const showPicker = ref(false); + +const onConfirm = ({ selectedOptions }) => { + console.log(selectedOptions) + showPicker.value = false; + cartStore.table_no = selectedOptions[0].value; +}; + const onSubmit = () => { router.push("/checkout"); };