修复部分布局样式
This commit is contained in:
1 parent
7c083a9900
commit
c31c2304c2
6 files changed
+36
-38
No files matched your search
+8
-8
@@ -28,14 +28,6 @@ const tabbar: TabbarItem[] = [
|
||||
launchParam: ["selfMerchant"],
|
||||
auth: ["user"],
|
||||
},
|
||||
{
|
||||
pagePath: "pages/tabbar/onlineShop",
|
||||
text: "在线商城",
|
||||
iconPath: "/static/tabbar/online-shop.png",
|
||||
selectedIconPath: "/static/tabbar/online-shop-select.png",
|
||||
launchParam: ["onlineShop"],
|
||||
auth: ["user"],
|
||||
},
|
||||
{
|
||||
pagePath: "pages/tabbar/coopMerchant",
|
||||
text: "合作商家",
|
||||
@@ -44,6 +36,14 @@ const tabbar: TabbarItem[] = [
|
||||
launchParam: ["coopMerchant"],
|
||||
auth: ["user"],
|
||||
},
|
||||
{
|
||||
pagePath: "pages/tabbar/onlineShop",
|
||||
text: "在线商城",
|
||||
iconPath: "/static/tabbar/online-shop.png",
|
||||
selectedIconPath: "/static/tabbar/online-shop-select.png",
|
||||
launchParam: ["onlineShop"],
|
||||
auth: ["user"],
|
||||
},
|
||||
{
|
||||
pagePath: "pages/tabbar/cabinet",
|
||||
text: "智能柜",
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<view>
|
||||
<view v-if="state.detail.phone" class="flex items-center">
|
||||
<image class="w-24rpx h-24rpx" src="@/static/page/phone.svg" />
|
||||
<view class="second-text-28 ml-1">{{ state.detail.phone }}</view>
|
||||
<view class="second-text-28 ml-1">{{ state.detail.phone?.slice(0, 11) }}</view>
|
||||
<view
|
||||
class="second-text-20 bg-#f8f8f8 ml-1 p-0.3 flex items-center rounded-1 border border-solid border-b-coolGray"
|
||||
@tap="doPhone"
|
||||
@@ -69,7 +69,7 @@
|
||||
</tm-alert>
|
||||
|
||||
<!-- start 商品 start -->
|
||||
<view class="flex-row">
|
||||
<view v-if="false" class="flex-row">
|
||||
<scroll-view
|
||||
v-if="state.classifyList.length"
|
||||
scroll-y
|
||||
@@ -108,7 +108,7 @@
|
||||
<!-- end 商品 end -->
|
||||
|
||||
<template #main-bottom>
|
||||
<view v-if="state.classifyList.length" class="car z-200 p-x-30rpx p-y-30rpx bg-white">
|
||||
<view v-if="false && state.classifyList.length" class="car z-200 p-x-30rpx p-y-30rpx bg-white">
|
||||
<product-total :totPrice="state.totPrice" :totCount="state.totCount" @doContainer="doVisibleCart" @submit="doBuy" />
|
||||
</view>
|
||||
</template>
|
||||
@@ -337,7 +337,7 @@ const doPhone = () => {
|
||||
return
|
||||
}
|
||||
;(window as any).dd
|
||||
.callPhone({ phoneNum: state.detail.phone })
|
||||
.callPhone({ phoneNum: state.detail.phone.slice(0, 11) })
|
||||
.then((res) => {})
|
||||
.catch((err) => {})
|
||||
}
|
||||
|
||||
@@ -18,14 +18,15 @@
|
||||
<template #top>
|
||||
<view class="flex justify-between items-center my-1 z-1000">
|
||||
<tm-text font-size="40" color="#0779FD" class="font-bold">欢迎选购</tm-text>
|
||||
<view class="flex justify-center items-baseline" @tap="changeShop">
|
||||
<tm-icon name="map-pin-2-line" color="#0779FD" />
|
||||
<view class="flex justify-center items-center" @tap="changeShop">
|
||||
<image class="size-40rpx" src="@/static/page/address-blue.svg" />
|
||||
<tm-text font-size="32" color="#0779FD">{{ state.curMerchant.name }}</tm-text>
|
||||
<tm-icon name="arrow-down-s-fill" color="#0779FD" size="40" />
|
||||
<image class="size-30rpx ml-1" src="@/static/page/arrow-down-s-fill.svg" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row justify-between items-center">
|
||||
<view class="w-full flex items-center">
|
||||
<tm-input
|
||||
class="flex-1"
|
||||
v-model="state.params.productName"
|
||||
type="text"
|
||||
:height="66"
|
||||
@@ -34,8 +35,9 @@
|
||||
:showClear="true"
|
||||
:focus="true"
|
||||
placeholder="请输入商品名称"
|
||||
style="border: 2px solid #0779fd; border-radius: 14rpx"
|
||||
style="border: 2rpx solid #0779fd; border-radius: 14rpx"
|
||||
:focus-highlight="false"
|
||||
color="#ECF4F9"
|
||||
>
|
||||
<template v-slot:rightIcon>
|
||||
<tm-button class="mr-1 py-3" size="xs" @click="searchProduct">搜索</tm-button>
|
||||
@@ -51,7 +53,7 @@
|
||||
|
||||
<scroll-view scroll-x class="whitespace-nowrap my-2">
|
||||
<tm-tag
|
||||
class="mx-1"
|
||||
class="mr-2"
|
||||
size="s"
|
||||
:skin="state.params.categoryId == v.id ? 'normal' : 'outlined'"
|
||||
v-for="(v, i) in state.classifyList"
|
||||
@@ -148,7 +150,7 @@ import { LazyImg, Waterfall } from "vue-waterfall-plugin-next"
|
||||
import "vue-waterfall-plugin-next/dist/style.css"
|
||||
import { isEmpty } from "radash"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { foodApi, merchantApi, shopApi } from "@@/api"
|
||||
import { merchantApi, shopApi } from "@@/api"
|
||||
import { hooks, router } from "@@/index"
|
||||
import { useCartStore } from "@/sheep/stores/cart"
|
||||
|
||||
@@ -177,6 +179,7 @@ onLoad(async () => {
|
||||
|
||||
await getAllMerchant()
|
||||
await getClassify()
|
||||
cartStore.saveShopMerchantId(state.curMerchant.id)
|
||||
await cartStore.getShopCart()
|
||||
})
|
||||
|
||||
@@ -209,6 +212,7 @@ const getClassify = async () => {
|
||||
if (state.curMerchant.id) {
|
||||
const { data } = await shopApi.getSupermarketSpuCategory({ merchantId: state.curMerchant.id })
|
||||
state.classifyList = data ?? []
|
||||
state.classifyList.unshift({ id: "", name: "全部分类" })
|
||||
if (!isEmpty(state.classifyList)) {
|
||||
state.params.categoryId = state.classifyList[0].id
|
||||
pageRef.value && pageRef.value.reload(true)
|
||||
@@ -227,11 +231,13 @@ const confirmRadioMerchant = async () => {
|
||||
state.curMerchant = state.merchantList.find((item: any) => item.id == state.curMerchantRadioId)
|
||||
state.showDrawer = false
|
||||
await getClassify()
|
||||
cartStore.saveShopMerchantId(state.curMerchant.id)
|
||||
await cartStore.getShopCart()
|
||||
}
|
||||
|
||||
// 点击搜索
|
||||
const searchProduct = () => {
|
||||
state.params.categoryId = ""
|
||||
pageRef.value && pageRef.value.reload(true)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,36 +4,26 @@ import { foodApi } from "../api"
|
||||
export const useCartStore = defineStore("cartStore", {
|
||||
state: () => ({
|
||||
cart: JSON.parse(uni.getStorageSync("cart") || "[]"),
|
||||
shopMerchantId: uni.getStorageSync("shopMerchantId") || "",
|
||||
}),
|
||||
getters: {
|
||||
totCount(state) {
|
||||
return state.cart.reduce((prev, cur) => {
|
||||
return state.cart.reduce((prev: string, cur: any) => {
|
||||
return prev + cur.productCount
|
||||
}, 0)
|
||||
},
|
||||
totPrice(state) {
|
||||
return state.cart
|
||||
.map((item) => Number(item.totalPrice))
|
||||
.reduce((prev, cur) => prev + cur, 0)
|
||||
.map((item: any) => Number(item.totalPrice))
|
||||
.reduce((prev: number, cur: number) => prev + cur, 0)
|
||||
.toFixed(2)
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
// 更新购物车中商品数量的方法
|
||||
updataGoodsCount(goods) {
|
||||
// 从购物车数组对象中查找到需要更新的这件商品
|
||||
const findResult = this.cart.find((item) => {
|
||||
return item.goods_id === goods.goods_id
|
||||
})
|
||||
// 如果查找到,就把这件商品传递的最新数量保存,并本地存储
|
||||
if (findResult) {
|
||||
findResult.goods_count = goods.goods_count
|
||||
this.saveToStorage()
|
||||
}
|
||||
saveShopMerchantId(shopMerchantId: string) {
|
||||
this.shopMerchantId = shopMerchantId
|
||||
uni.setStorageSync("shopMerchantId", this.shopMerchantId)
|
||||
},
|
||||
|
||||
// ===================================================================
|
||||
|
||||
saveToStorage() {
|
||||
uni.setStorageSync("cart", JSON.stringify(this.cart))
|
||||
},
|
||||
@@ -71,7 +61,7 @@ export const useCartStore = defineStore("cartStore", {
|
||||
await this.getShopCart()
|
||||
},
|
||||
async getShopCart() {
|
||||
const { data } = await foodApi.getShopCar({ merchantId: "1931916121241079810", hardType: "SUPERMARKET" })
|
||||
const { data } = await foodApi.getShopCar({ merchantId: this.shopMerchantId, hardType: "SUPERMARKET" })
|
||||
this.saveShoppingCart(data ?? [])
|
||||
},
|
||||
async updateShopCart() {
|
||||
@@ -83,7 +73,7 @@ export const useCartStore = defineStore("cartStore", {
|
||||
productId: v.productId,
|
||||
}
|
||||
})
|
||||
const { code }: any = await foodApi.updateShopCar({ merchantId: "1931916121241079810", list, hardType: "SUPERMARKET" })
|
||||
const { code }: any = await foodApi.updateShopCar({ merchantId: this.saveShopMerchantId, list, hardType: "SUPERMARKET" })
|
||||
if (code == 0) return await this.getShopCart()
|
||||
uni.showToast({ title: "更新购物车失败", icon: "none" })
|
||||
},
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750384226152" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4917" data-spm-anchor-id="a313x.search_index.0.i6.81863a81aL498c" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M761.906 443.743c4.075-23.209 26.193-38.72 49.402-34.646 23.21 4.075 38.721 26.193 34.646 49.402C825.75 573.584 723.823 721.972 540.66 908.62c-16.725 17.043-44.18 17.043-60.905 0-205.386-209.293-309.088-370.672-309.088-491.875 0-183.302 152.278-331.41 339.54-331.41 136.446 0 258.175 79.33 311.633 199.64 9.569 21.535-0.132 46.748-21.666 56.316-21.534 9.569-46.747-0.132-56.316-21.666-39.78-89.528-130.972-148.957-233.65-148.957C369.55 170.667 256 281.109 256 416.744c0 86.412 84.168 222.13 254.208 400.62C662.761 657.25 746.527 531.34 761.906 443.745zM510.207 574.91c-88.886 0-161.416-70.544-161.416-158.165 0-87.62 72.53-158.164 161.416-158.164 88.887 0 161.417 70.543 161.417 158.164 0 87.621-72.53 158.165-161.417 158.165z m0-85.334c42.28 0 76.083-32.877 76.083-72.83 0-39.955-33.802-72.832-76.083-72.832-42.28 0-76.083 32.877-76.083 72.831s33.803 72.831 76.083 72.831z" fill="#3496F9" p-id="4918"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750384429039" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7956" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M905.386667 278.613333c28.501333 0 42.773333 34.474667 22.613333 54.634667L533.333333 727.914667a32 32 0 0 1-45.248 0l-394.666666-394.666667c-20.16-20.16-5.888-54.613333 22.613333-54.613333h789.333333z" fill="#3496F9" p-id="7957" data-spm-anchor-id="a313x.search_index.0.i14.81863a81aL498c" class="selected"></path></svg>
|
||||
|
After Width: | Height: | Size: 652 B |
Reference in new issue
Block a user