feat:购物车订单

This commit is contained in:
dzc committed 2025-01-08 14:03:43 +08:00
1 parent f15d3dbe90
commit ce027925d4
7 files changed
+35 -35

No files matched your search

+2 -2
View File
@@ -22,8 +22,8 @@ VITE_IMAGE_BASE_PATH = http://localhost:9999
# ******************** start 开发环境 start ********************
# VITE_APP_DEV_SERVICE =http://123.156.228.134:48080/app-api
# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/app-api
VITE_APP_DEV_SERVICE = http://192.168.101.24:9999 # 邓-本地
# VITE_APP_DEV_SERVICE = http://localhost:9999
# VITE_APP_DEV_SERVICE = http://192.168.101.24:9999 # 邓-本地
VITE_APP_DEV_SERVICE = http://localhost:9999
# ******************** end 开发环境 end ********************
# ******************** start 生产环境 start ********************
@@ -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>({
})
+22 -21
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,7 +49,6 @@ const getDetail = async () => {
const getShopCar = async () => {
const _pa = { merchantId: state.detailId };
const { data } = await foodApi.getShopCar(_pa);
state.carList = data ?? [];
state.totPrice = state.carList
.map((v) => v.totalPrice)
@@ -72,7 +70,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,7 +87,6 @@ const getPorduct = async () => {
const target = state.classifyList[state.currentClassifyIndex];
if (isEmpty(target)) return;
const _pa = {
systemType: state.systemType,
merchantId: state.detailId,
categoryId: target.id,
};
@@ -104,15 +101,24 @@ const getPorduct = async () => {
}
});
const shopList = [...state.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;
// }
// }
// }
// }
// }
// }
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;
}
}
}
@@ -161,10 +167,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 +330,20 @@ 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 v-for="(pV, pI) in state.shopList" :key="pI">
<!-- <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> -->
<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
@@ -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">
+2 -2
View File
@@ -21,7 +21,7 @@ export default {
}),
product: (params: any) =>
request({
url: `/onlinefood/category/list`,
url: `/canteen/canteenOnlineSpu/app/getCanteenSpuList`,
method: "GET",
params,
custom: {
@@ -39,7 +39,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
@@ -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: {