Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-mobile-react-cloud
This commit is contained in:
commit
bc43f88e52
8 files changed
+79
-43
No files matched your search
@@ -17,18 +17,18 @@ VITE_PWD_ENC_KEY='pigxpigxpigxpigx'
|
||||
VITE_OAUTH2_APP_CLIENT='mini:mini'
|
||||
|
||||
# --------------------------- 开发环境 api地址 ----------------------------------
|
||||
# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
|
||||
VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
|
||||
#VITE_APP_DEV_SERVICE = http://59.202.170.152:81/api # 信创线上
|
||||
#VITE_APP_DEV_SERVICE = http://192.168.101.139:9999 # 邓-本地
|
||||
VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 # 邓-本地
|
||||
# VITE_APP_DEV_SERVICE = http://123.156.230.15:8089/api # 测试线上
|
||||
# VITE_APP_DEV_SERVICE = http://192.168.101.150:9999 # 邓-本地
|
||||
# VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 # 邓-本地
|
||||
# VITE_APP_DEV_SERVICE = http://123.157.250.162:8089/api # 测试线上
|
||||
|
||||
# --------------------------- 开发环境 图片访问基础地址 ---------------------------
|
||||
# VITE_IMAGE_DEV_PATH = https://stgl.pj.gov.cn/api # 域名线上
|
||||
VITE_IMAGE_DEV_PATH = https://stgl.pj.gov.cn/api # 域名线上
|
||||
#VITE_IMAGE_DEV_PATH = http://59.202.170.152:81/api # 信创线上
|
||||
#VITE_IMAGE_DEV_PATH = http://192.168.101.139:9999 # 邓-本地
|
||||
VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999
|
||||
# VITE_IMAGE_DEV_PATH = http://123.156.230.15:8089/api # 测试线上
|
||||
# VITE_IMAGE_DEV_PATH = http://192.168.101.150:9999 # 邓-43本地
|
||||
# VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999
|
||||
# VITE_IMAGE_DEV_PATH = http://123.157.250.162:8089/api # 测试线上
|
||||
|
||||
# --------------------------- 生产环境 api地址 ----------------------------------
|
||||
VITE_APP_PROD_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
<view class="text-32 ws-nowrap text-ellipsis overflow-hidden">{{ state.goodsDetail.productName }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="second-text-30 c-red!">
|
||||
促销 ¥{{ parseFloat(state.selectedSku.promotionPrice) || state.selectedSku.retailPrice || 0 }}
|
||||
促销 ¥{{ hooks.useMoney(state.selectedSku.promotionPrice) || hooks.useMoney(state.selectedSku.retailPrice) || 0 }}
|
||||
</view>
|
||||
<view class="m-l-20rpx second-text-28 line-through">原价 ¥{{ state.selectedSku.retailPrice || 0 }}</view>
|
||||
<view class="m-l-20rpx second-text-28 line-through">原价 ¥{{ hooks.useMoney(state.selectedSku.retailPrice) || 0 }}</view>
|
||||
</view>
|
||||
<view class="second-text-26">内装数量:{{ state.selectedSku.packageNum || 0 }}</view>
|
||||
<view class="second-text-26">库存:{{ state.selectedSku.stock || 0 }}</view>
|
||||
<view class="second-text-26">
|
||||
已选择:{{ `${state.selectedSku.spec || "未选择"} / ${state.selectedSku.unit || "未选择"},数量:${state.goodsCount}` }}
|
||||
</view>
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
<template #footer>
|
||||
<button
|
||||
class="mx-12 rounded-3 bg-#0094ff sub-text-30 py-2 c-white!"
|
||||
class="mx-12 rounded-3 bg-#0094ff sub-text-30 py-2 c-white! active:bg-#0094ff99"
|
||||
:class="{ 'bg-#0094ff77!': Object.keys(state.selectedSku).length === 0 }"
|
||||
@tap="handleSkuAddToCart"
|
||||
>
|
||||
@@ -87,6 +87,7 @@ import { filePath } from "@/sheep/utils/file"
|
||||
import { reactive, watch } from "vue"
|
||||
import { usePreviewImage } from "@/sheep/hooks/use-img"
|
||||
import { isEmpty } from "radash"
|
||||
import { hooks } from "@/sheep"
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "onSkuAddToCart"])
|
||||
|
||||
@@ -155,17 +156,18 @@ const handleSkuAddToCart = async () => {
|
||||
if (!state.selectedSku.id) return uni.showToast({ title: "请选择包装单位", icon: "none" })
|
||||
|
||||
// 检查库存
|
||||
try {
|
||||
uni.showLoading({ title: "加载中", mask: true })
|
||||
const { code }: any = await shopApi.checkSpuStock({ spuId: state.goodsDetail.id, incrCount: state.goodsCount })
|
||||
if (code != 0) return uni.showToast({ title: "库存不足", icon: "none" })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
// try {
|
||||
// uni.showLoading({ title: "加载中", mask: true })
|
||||
// const { code }: any = await shopApi.checkSpuStock({ spuId: state.goodsDetail.id, incrCount: state.goodsCount })
|
||||
// if (code != 0) return uni.showToast({ title: "库存不足", icon: "none" })
|
||||
// } catch (e) {
|
||||
// console.error(e)
|
||||
// } finally {
|
||||
// uni.hideLoading()
|
||||
// }
|
||||
// 检查库存
|
||||
if (state.goodsDetail.stock === 0) return uni.showToast({ title: "库存不足", icon: "none" })
|
||||
if (state.goodsDetail.stock === 0 || Number(state.goodsCount) > Number(state.selectedSku.stock))
|
||||
return uni.showToast({ title: "库存不足", icon: "none" })
|
||||
|
||||
emit("onSkuAddToCart", {
|
||||
spuId: state.goodsDetail.id,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
import { shopApi } from "@@/api"
|
||||
import { onlineShopApi } from "@@/api"
|
||||
import { filePath } from "@/sheep/utils/file"
|
||||
import ProductSku from "./components/product-sku.vue"
|
||||
import { useCartStore } from "@/sheep/stores/cart"
|
||||
@@ -26,7 +26,7 @@ onShow(() => {
|
||||
})
|
||||
|
||||
const getDetail = async () => {
|
||||
const { data } = await shopApi.getSupermarketSpuDetail({ id: state.detailId })
|
||||
const { data } = await onlineShopApi.getSpuDetail(state.detailId)
|
||||
state.detail = data ?? {}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ const doCart = async () => {
|
||||
<view class="prefix_title mb-15rpx">商品</view>
|
||||
<view class="sub-text-32">{{ state.detail?.productName }}</view>
|
||||
<view class="flex-row items-center justify-between m-t-15rpx">
|
||||
<view class="second-text-26">库存{{ state.detail?.stock }}</view>
|
||||
<view class="second-text-26">已售{{ state.detail?.salesCount }}</view>
|
||||
<view class="second-text-26">限购:{{ state.detail?.limitNum || 0 }}</view>
|
||||
<view class="second-text-26">已售:{{ state.detail?.salesCount || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -80,12 +80,14 @@ const doCart = async () => {
|
||||
<view class="prefix_title mb-15rpx">包装</view>
|
||||
<view class="flex flex-wrap">
|
||||
<view class="w-1/3 flex justify-center p-1" v-for="(item, index) in state.detail?.skuList" :key="index">
|
||||
<view class="p-2 bg-#eeeeee77 rounded-3 flex-col items-center">
|
||||
<view class="p-2 w-full bg-#eeeeee77 rounded-3 flex-col items-center">
|
||||
<view class="second-text-28">{{ item.spec + " / " + item.unit }}</view>
|
||||
<view class="second-text-28">内装:{{ item.packageNum }}</view>
|
||||
<view class="second-text-28">库存:{{ item?.stock || 0 }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="second-text-30 c-red!">¥{{ parseFloat(item.promotionPrice) || item.retailPrice || 0 }}</view>
|
||||
<view class="ml-4rpx second-text-30 line-through">¥{{ item.retailPrice || 0 }}</view>
|
||||
<view class="second-text-28 c-red!">
|
||||
¥{{ hooks.useMoney(item.promotionPrice) || hooks.useMoney(item.retailPrice) || 0 }}
|
||||
</view>
|
||||
<view class="ml-4rpx second-text-28 line-through">¥{{ hooks.useMoney(item.retailPrice) || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -85,8 +85,6 @@ const state = reactive<{
|
||||
{ text: "扫一扫", icon: "/static/icon/scan.png", router: "" },
|
||||
{ text: "钱包管理", icon: "/static/icon/service_3.png", router: "/pages/wallet/list" },
|
||||
// { text: "包厢预定", icon: "/static/icon/service_4.png", router: "/pages/boxes/apply-list" },
|
||||
{ text: "外来人员就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/foreign-list" },
|
||||
{ text: "跨单位就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/stride-list" },
|
||||
{ text: "人脸管理", icon: "/static/icon/service_5.png", router: "/pages/human-face/list" },
|
||||
{ text: "清除缓存", icon: "/static/icon/clear-storage.png", router: "" },
|
||||
],
|
||||
@@ -403,6 +401,8 @@ const doChangeRole = () => {
|
||||
// 初始化配置菜单
|
||||
const initMenuConfig = () => {
|
||||
if (isDevEnv()) {
|
||||
state.menuList.push({ text: "dev-外来人员就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/foreign-list" })
|
||||
state.menuList.push({ text: "dev-跨单位就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/stride-list" })
|
||||
state.menuList.push({
|
||||
text: "测试-第三方应用",
|
||||
icon: "/static/icon/login.png",
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
¥{{ hooks.useMoney(item.retailPrice) || 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="second-text-26">已售:{{ item.salesCount }}</view>
|
||||
<view class="second-text-26">已售:{{ item.salesCount || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -150,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 { merchantApi, shopApi } from "@@/api"
|
||||
import { merchantApi, onlineShopApi } from "@@/api"
|
||||
import { hooks, router } from "@@/index"
|
||||
import { useCartStore } from "@/sheep/stores/cart"
|
||||
|
||||
@@ -191,9 +191,9 @@ onShow(() => {
|
||||
const getAllMerchant = async () => {
|
||||
uni.showLoading({ title: "加载中...", mask: true })
|
||||
try {
|
||||
const res: any = await merchantApi.page({ current: 1, pagesize: 9999999, type: "3" })
|
||||
if (res.code == 0) {
|
||||
state.merchantList = res.data.records
|
||||
const { code, data }: any = await merchantApi.page({ current: 1, pagesize: 9999999, type: "3" })
|
||||
if (code == 0) {
|
||||
state.merchantList = data.records
|
||||
if (!isEmpty(state.merchantList)) {
|
||||
state.curMerchant = state.merchantList[0]
|
||||
return
|
||||
@@ -207,11 +207,22 @@ const getAllMerchant = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const treeToList = <T extends { children?: T[] }>(tree: T[], result: T[] = []): T[] => {
|
||||
for (const node of tree) {
|
||||
result.push(node)
|
||||
if (node?.children?.length) {
|
||||
treeToList(node.children, result)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// 获取分类
|
||||
const getClassify = async () => {
|
||||
if (state.curMerchant.id) {
|
||||
const { data } = await shopApi.getSupermarketSpuCategory({ merchantId: state.curMerchant.id })
|
||||
state.classifyList = data ?? []
|
||||
// const { data } = await shopApi.getSupermarketSpuCategory({ merchantId: state.curMerchant.id })
|
||||
const { data } = await onlineShopApi.getSpuCategory()
|
||||
state.classifyList = treeToList(data) ?? []
|
||||
state.classifyList.unshift({ id: "", name: "全部分类" })
|
||||
if (!isEmpty(state.classifyList)) {
|
||||
state.params.categoryId = state.classifyList[0].id
|
||||
@@ -230,7 +241,6 @@ const changeShop = () => {
|
||||
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()
|
||||
}
|
||||
@@ -248,10 +258,10 @@ const doClassify = async (categoryId: string) => {
|
||||
pageRef.value && pageRef.value.reload(true)
|
||||
}
|
||||
|
||||
const pageHook = hooks.usePage(pageRef, shopApi.getSupermarketSpuList, null, "data.records")
|
||||
const pageHook = hooks.usePage(pageRef, onlineShopApi.getSpuList, null, "data.records")
|
||||
|
||||
const query = (page: number, pagesize: number) => {
|
||||
pageHook.startPage(page, pagesize, false, { ...state.params, merchantId: state.curMerchant.id })
|
||||
pageHook.startPage(page, pagesize, false, state.params)
|
||||
}
|
||||
|
||||
const toDetail = async (v: any) => {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { hooks, router } from "@@/index"
|
||||
import { hooks } from "@@/index"
|
||||
import { merchantApi } from "@@/api"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ export { default as faceApi } from "./face"
|
||||
|
||||
export { default as shopApi } from "./shop"
|
||||
|
||||
export { default as onlineShopApi } from "./onlineShop"
|
||||
|
||||
export { default as flowStatisticsApi } from "./flowStatistics"
|
||||
|
||||
export { default as individualOrderApi } from "./individualOrder"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import request from "@/sheep/utils/request"
|
||||
|
||||
export default {
|
||||
getSpuCategory: () =>
|
||||
request({
|
||||
url: "/supermarket/app/shopCategory/list",
|
||||
method: "GET",
|
||||
}),
|
||||
getSpuList: (params: any) =>
|
||||
request({
|
||||
url: "/supermarket/app/shopSpu/page",
|
||||
method: "GET",
|
||||
params,
|
||||
}),
|
||||
getSpuDetail: (id: any) =>
|
||||
request({
|
||||
url: `/supermarket/app/shopSpu/detail/${id}`,
|
||||
method: "GET",
|
||||
}),
|
||||
}
|
||||
Reference in new issue
Block a user