# Conflicts:
#	.env
This commit is contained in:
zjf committed 2025-01-09 12:02:22 +08:00
commit 101dedd1bc
10 files changed
+110 -112

No files matched your search

@@ -8,6 +8,8 @@ import { merchantApi } from "@@/api"
import ProductRow from './product-row.vue'
import ProductTotal from './product-total.vue'
import { filePath } from "@@/utils/file";
const emit = defineEmits(["update:modelValue", "submit", "doContainer", "add", "remove"])
export type Props = {
@@ -57,7 +59,7 @@ const getHeight = () => {
<template>
<tm-drawer z-index="100" v-model:show="props.modelValue" showFooter title="购物车" position="bottom" size="60%"
@close="doClose">
<product-row v-for="(v, i) in props.carList" mode="car" :key="v.id" v-model="v.productCount" :pic="v.productPic"
<product-row v-for="(v, i) in props.carList" mode="car" :key="v.id" v-model="v.productCount" :pic="filePath(v.productPic)"
:count="v.productCount" :name="v.name" :price="v.productPrice" :marketPrice="v.marketPrice"
:salesCount="v.salesCount" :stock="v.stock" @add="() => emit('add', v)" @remove="emit('remove', v)" />
<template #footer>
@@ -13,7 +13,7 @@ export type Props = {
modelValue: number,
pic: string,
name: string,
price: number,
price: any,
marketPrice: number,
salesCount: number,
stock: number,
@@ -31,7 +31,6 @@ const props = withDefaults(defineProps<Props>(), {
stock: 0,
count: 0,
});
const state = reactive<any>({
})
+19 -37
View File
@@ -18,7 +18,6 @@ import ProductTotal from "./components/product-total.vue";
const data = {};
const state = reactive<any>({
detailId: null,
systemType: 3,
totPrice: 0,
totCount: 0,
currentClassifyIndex: 0,
@@ -50,14 +49,15 @@ const getDetail = async () => {
const getShopCar = async () => {
const _pa = { merchantId: state.detailId };
const { data } = await foodApi.getShopCar(_pa);
state.carList = data ?? [];
asyncCarCount(state.shopList)
state.totPrice = state.carList
.map((v) => v.totalPrice)
.map((v) => Number(v.totalPrice))
.reduce((pre, next) => pre + next, 0);
state.totCount = state.carList
.map((v) => v.productCount)
.reduce((pre, next) => pre + next, 0);
};
const getClassify = async () => {
@@ -72,7 +72,7 @@ const getClassify = async () => {
const updateShopCar = async () => {
if (isEmpty(state.carList)) return;
const list = state.carList
.filter((v) => v.productCount && v.productCount > 0)
.filter((v) => v.productCount !== undefined && v.productCount >= 0)
.map((v) => {
return {
productCount: v.productCount,
@@ -89,36 +89,30 @@ const getPorduct = async () => {
const target = state.classifyList[state.currentClassifyIndex];
if (isEmpty(target)) return;
const _pa = {
systemType: state.systemType,
merchantId: state.detailId,
categoryId: target.id,
};
const { data } = await foodApi.product(_pa);
state.shopList = data;
state.shopList.forEach((i) => {
if (i && i.foodSPURespVOList && i.foodSPURespVOList.length) {
i.foodSPURespVOList.forEach((j) => {
j.productCount = 0;
j.productId = j.id;
});
}
data.forEach((i: any) => {
i.productCount = 0;
i.productId = i.id;
});
const shopList = [...state.shopList];
asyncCarCount(data)
};
// 同步购买数量
const asyncCarCount = (shopList)=>{
if (state.carList && state.carList.length) {
for (const i of shopList) {
if (i && i.foodSPURespVOList && i.foodSPURespVOList.length) {
for (const j of i.foodSPURespVOList) {
for (const v of state.carList) {
if (j.id == v.productId) {
j.productCount = v.productCount;
}
}
for (const v of state.carList) {
if (i.id == v.productId) {
i.productCount = v.productCount;
}
}
}
}
state.shopList = shopList;
};
}
const doAdd = async (item: any) => {
chentProductCount(item);
@@ -161,10 +155,6 @@ const submitPay = async () => {
const { data: createData, code: createCode }: any =
await payApi.createHardwareOrder(_createtPa);
if (createCode != 0) throw new Error();
const _submitPa = { orderId: createData };
const { data: submitData, code: submitCode }: any =
await payApi.submitHardwareOrder(_submitPa);
if (submitCode != 0) throw new Error();
uni.hideLoading();
uni.showToast({ title: "支付成功", icon: "none" });
router.jump("/pages/tabbar/order");
@@ -328,21 +318,13 @@ const doFood = () => {
:style="{ height: getHeight() }"
class="flex-1 p-b-20rpx"
>
<view v-for="(cV, cI) in state.shopList" :key="cI">
<view class="flex-row-center m-y-20rpx">
<view class="w-25rpx h-1px bg-#d2d2d2" />
<text class="p-x-15rpx second-text-28">
{{ cV.categoryName }}
</text>
<view class="w-25rpx h-1px bg-#d2d2d2" />
</view>
<view v-for="(pV, pI) in state.shopList" :key="pI">
<view class="m-x-15rpx">
<product-row
v-for="(pV, pI) in cV.foodSPURespVOList"
:key="pV.id"
v-model="pV.productCount"
:productId="pV.productId"
:pic="pV.picUrl"
:productId="pV.id"
:pic="filePath(pV.picUrl)"
:name="pV.name"
:price="pV.price"
:marketPrice="pV.marketPrice"
+3 -3
View File
@@ -42,7 +42,7 @@ onShow(() => {
})
const pageRef = ref<any>(null)
const pageHook = hooks.usePage(pageRef, foodApi.page, null, 'data.list')
const pageHook = hooks.usePage(pageRef, foodApi.page, null, 'data.records')
const query = (page: number, pagesize: number) => {
pageHook.startPage(page, pagesize, false, state.pa);
}
@@ -60,13 +60,13 @@ const initDate = () => {
})
}
state.dateList = list
state.pa.day = state.dateList[0].dateTime
state.pa.startTime = state.dateList[0].dateTime
pageRef.value?.reload(false)
}
const doDateItem = (v: any, i: any) => {
state.currentDateIndex = i
state.pa.day = state.dateList[i].dateTime
state.pa.startTime = state.dateList[i].dateTime
pageRef.value.reload(true)
}
+65 -54
View File
@@ -1,76 +1,87 @@
<script setup lang="ts">
import { ref, reactive } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { isEmpty } from 'radash'
import { isEmpty } from "radash";
import { hooks } from "@@/index"
import { productApi } from "@@/api"
import { hooks } from "@@/index";
import { productApi } from "@@/api";
import zSwiper from "@zebra-ui/swiper/components/z-swiper/z-swiper.vue"
import zSwiperItem from "@zebra-ui/swiper/components/z-swiper-item/z-swiper-item.vue"
import { filePath } from "@@/utils/file";
const data = {
}
import zSwiper from "@zebra-ui/swiper/components/z-swiper/z-swiper.vue";
import zSwiperItem from "@zebra-ui/swiper/components/z-swiper-item/z-swiper-item.vue";
const data = {};
const state = reactive<any>({
detailId: null,
detail: null,
})
detailId: null,
detail: null,
});
onLoad((options: any) => {
if (!isEmpty(options.id)) {
state.detailId = options.id
}
if (!isEmpty(options.id)) {
state.detailId = options.id;
}
});
onShow(() => {
getDetail()
})
getDetail();
});
const getDetail = async () => {
const _pa = { id: state.detailId }
const { data } = await productApi.get(_pa)
state.detail = data
}
const _pa = { id: state.detailId };
const { data } = await productApi.get(_pa);
state.detail = data;
};
</script>
<template>
<crud-layout title="订单详情" tabBarType="just-flot-back" bg="/static/page/blue-bg.png">
<z-swiper>
<z-swiper-item v-for="(v, i) in state.detail.sliderPicUrls" :key="i">
<image class="w-100vw" :src="v" mode="widthFix" />
</z-swiper-item>
</z-swiper>
<view class="p-x-15rpx">
<view class="flex-col justify-between card p-y-20rpx p-x-30rpx">
<view class="flex-row items-center justify-between">
<view class="flex-row items-center">
<view class="second-text-46 color-#f63a36!">¥{{ state.detail.price }}</view>
<view class="m-l-20rpx second-text-28 line-through">¥{{ state.detail.marketPrice }}</view>
</view>
<view class="second-text-26">已售{{ state.detail.salesCount }}</view>
</view>
<view class="flex-col m-t-15rpx">
<view class="sub-text-32">{{ state.detail.name }}</view>
<view class="m-t-15rpx second-text-26">{{ state.detail.introduction }}</view>
</view>
</view>
<view class="h-15rpx" />
<view class="flex-row items-center justify-between card p-y-20rpx p-x-30rpx">
<view class="prefix_title">评价</view>
</view>
<view class="h-15rpx" />
<view class="flex-col justify-between card p-y-20rpx p-x-30rpx">
<view class="prefix_title">详情</view>
<view class="m-t-15rpx" v-html="state.detail.description"></view>
</view>
<crud-layout
title="订单详情"
tabBarType="just-flot-back"
bg="/static/page/blue-bg.png"
>
<image
class="w-100vw"
:src="filePath(state.detail.picUrl)"
mode="widthFix"
/>
<view class="p-x-15rpx">
<view class="flex-col justify-between card p-y-20rpx p-x-30rpx">
<view class="flex-row items-center justify-between">
<view class="flex-row items-center">
<view class="second-text-46 color-#f63a36!"
>¥{{ state.detail.price }}</view
>
<view class="m-l-20rpx second-text-28 line-through"
>¥{{ state.detail.marketPrice }}</view
>
</view>
<view class="second-text-26">已售{{ state.detail.salesCount }}</view>
</view>
</crud-layout>
<view class="flex-col m-t-15rpx">
<view class="sub-text-32">{{ state.detail.name }}</view>
<view class="m-t-15rpx second-text-26">{{
state.detail.introduction
}}</view>
</view>
</view>
<view
v-if="false"
class="m-t-15rpx flex-row items-center justify-between card p-y-20rpx p-x-30rpx"
>
<view class="prefix_title">评价</view>
</view>
<view v-if="state.detail.description" class="m-t-15rpx flex-col justify-between card p-y-20rpx p-x-30rpx">
<view class="prefix_title">详情</view>
<view class="m-t-15rpx" v-html="state.detail.description"></view>
</view>
</view>
</crud-layout>
</template>
<style lang="scss" scoped>
:deep() {
.layout_main>scroll-view {
padding: 0 !important;
}
.layout_main > scroll-view {
padding: 0 !important;
}
}
</style>
</style>
+3 -3
View File
@@ -31,7 +31,7 @@ onShow(() => {
})
const pageRef = ref<any>(null)
const pageHook = hooks.usePage(pageRef, walletApi.transaction, null, 'data.list')
const pageHook = hooks.usePage(pageRef, walletApi.transaction, null, 'data.records')
const query = (page: number, pagesize: number) => {
pageHook.startPage(page, pagesize, false, state.pa);
}
@@ -61,12 +61,12 @@ const doTab = (e: any) => {
v-for="(v, i) in pageHook.list" :key="i">
<view class="flex">
<view class="w-150rpx flex justify-left p-r-25rpx">
<tm-tag v-if="v.title == '更新余额'" size="m">{{ v.title }}</tm-tag>
<tm-tag v-if="v.title == '充值'" size="m">{{ v.title }}</tm-tag>
<tm-tag v-if="v.title == '支付'" color="error" size="m">支付交易</tm-tag>
<tm-tag v-if="v.title == '支付退款'" color="info" size="m">{{ v.title }}</tm-tag>
</view>
<view class="flex-row-center">
<text class="sub-text-30">{{ v.price }}</text>
<text class="sub-text-30">{{ hooks.useMoney(v.price) }}元</text>
</view>
</view>
<view class="sub-text-24 text-right">
+10 -6
View File
@@ -1,11 +1,15 @@
import request from "@/sheep/utils/request";
export default {
page: (params: any) =>
page: (data: any) =>
request({
url: `/canteen/canteenDailyMenu/ad/getCanteenList`,
method: "GET",
params,
url: `/canteen/canteenDailyMenu/app/page`,
method: "POST",
data,
params:{
pageNo: data.pageNo,
pagesize: data.pagesize
},
custom: {
showLoading: false,
},
@@ -21,7 +25,7 @@ export default {
}),
product: (params: any) =>
request({
url: `/onlinefood/category/list`,
url: `/canteen/canteenOnlineSpu/app/getCanteenSpuList`,
method: "GET",
params,
custom: {
@@ -39,7 +43,7 @@ export default {
}),
updateShopCar: (data: any) =>
request({
url: `/hard/car/save-or-upload`,
url: `/hard/hard-car/app/save-or-upload`,
method: "POST",
data,
custom: {
+4 -4
View File
@@ -18,11 +18,11 @@ export default {
});
},
// 创建硬件订单
createHardwareOrder: (data) => {
createHardwareOrder: (params) => {
return request({
url: "/hardware/order/create-order",
method: "POST",
data,
url: "/hard/hard-order/app/create-order",
method: "GET",
params,
custom: {
showLoading: false,
},
+1 -1
View File
@@ -3,7 +3,7 @@ import request from "@/sheep/utils/request";
export default {
get: (params) => {
return request({
url: "/onlinefood/spu/get-detail",
url: "/canteen/canteenOnlineSpu/app/getCanteenSpuDetails",
method: "GET",
params,
});
+1 -1
View File
@@ -56,7 +56,7 @@ export default {
}),
transaction: (params: any) =>
request({
url: "wallet/wallet-transaction/page",
url: "wallet/wallet-transaction/app/page",
method: "GET",
params,
custom: {