update: 待出库接口对接

This commit is contained in:
admin 2024-03-09 20:37:17 +08:00
parent c98484dc78
commit 2df6a8b456
44 changed files with 2491 additions and 947 deletions

View File

@ -62,6 +62,7 @@
"pinia": "2.0.33", "pinia": "2.0.33",
"pinia-plugin-persistedstate": "^3.2.1", "pinia-plugin-persistedstate": "^3.2.1",
"postcss-pxtorem": "^6.0.0", "postcss-pxtorem": "^6.0.0",
"underscore": "^1.13.6",
"unplugin-auto-import": "^0.17.3", "unplugin-auto-import": "^0.17.3",
"uview-plus": "^3.1.41", "uview-plus": "^3.1.41",
"vue": "^3.2.45", "vue": "^3.2.45",
@ -74,6 +75,7 @@
"@dcloudio/uni-stacktracey": "3.0.0-3081220230817001", "@dcloudio/uni-stacktracey": "3.0.0-3081220230817001",
"@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001", "@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001",
"@types/node": "^20.11.22", "@types/node": "^20.11.22",
"@types/underscore": "^1.11.15",
"@types/wechat-miniprogram": "^3.4.7", "@types/wechat-miniprogram": "^3.4.7",
"@uni-helper/uni-app-types": "^0.5.12", "@uni-helper/uni-app-types": "^0.5.12",
"@uni-helper/uni-ui-types": "^0.5.11", "@uni-helper/uni-ui-types": "^0.5.11",

View File

@ -74,6 +74,9 @@ dependencies:
postcss-pxtorem: postcss-pxtorem:
specifier: ^6.0.0 specifier: ^6.0.0
version: 6.1.0(postcss@8.4.35) version: 6.1.0(postcss@8.4.35)
underscore:
specifier: ^1.13.6
version: 1.13.6
unplugin-auto-import: unplugin-auto-import:
specifier: ^0.17.3 specifier: ^0.17.3
version: 0.17.5 version: 0.17.5
@ -106,6 +109,9 @@ devDependencies:
'@types/node': '@types/node':
specifier: ^20.11.22 specifier: ^20.11.22
version: 20.11.22 version: 20.11.22
'@types/underscore':
specifier: ^1.11.15
version: 1.11.15
'@types/wechat-miniprogram': '@types/wechat-miniprogram':
specifier: ^3.4.7 specifier: ^3.4.7
version: 3.4.7 version: 3.4.7
@ -3095,6 +3101,10 @@ packages:
resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==}
dev: true dev: true
/@types/underscore@1.11.15:
resolution: {integrity: sha512-HP38xE+GuWGlbSRq9WrZkousaQ7dragtZCruBVMi0oX1migFZavZ3OROKHSkNp/9ouq82zrWtZpg18jFnVN96g==}
dev: true
/@types/wechat-miniprogram@3.4.7: /@types/wechat-miniprogram@3.4.7:
resolution: {integrity: sha512-X6SVOOaTPQN24lYBSV5jLuWyIedx8DGJnT0VUBnoNzJruhxotCL28ecGb7AO5JfXOXtHqSS5+CnJ70NxFxmisA==} resolution: {integrity: sha512-X6SVOOaTPQN24lYBSV5jLuWyIedx8DGJnT0VUBnoNzJruhxotCL28ecGb7AO5JfXOXtHqSS5+CnJ70NxFxmisA==}
dev: true dev: true
@ -6784,6 +6794,10 @@ packages:
resolution: {integrity: sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==} resolution: {integrity: sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==}
dev: false dev: false
/underscore@1.13.6:
resolution: {integrity: sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==}
dev: false
/undici-types@5.26.5: /undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}

7
readme.md Normal file
View File

@ -0,0 +1,7 @@
## 获取接口字段
```
let c = a.data[22].requestBody.jsonSchema.properties
for (let i = 0; i < Object.keys(c).length; i++) {
console.log(Object.keys(c)[i], + ':',c[Object.keys(c)[i]].type + '; //' + c[Object.keys(c)[i]].description )
}
```

View File

@ -8,8 +8,8 @@
</view> </view>
<template #confirmButton> <template #confirmButton>
<view class="btn-box"> <view class="btn-box">
<text class="cancel" @click="handleClose(false)">取消</text> <text class="cancel" @click="handleClose('cancel')">取消</text>
<text class="ok" @click="handleClose(false)">{{ okText }}</text> <text class="ok" @click="handleClose('ok')">{{ okText }}</text>
</view> </view>
</template> </template>
</u-modal> </u-modal>
@ -30,9 +30,13 @@ const props = withDefaults(
show: false show: false
} }
); );
const emit = defineEmits(["handleModal"]); const emit = defineEmits(["handleModal", "handleOk"]);
const handleClose = () => { const handleClose = (v: string) => {
emit("handleModal", false); emit("handleModal", false);
if (v === 'ok') {
//
emit("handleOk");
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,6 +1,8 @@
// 不同的环境变量配置 // 不同的环境变量配置
const development = { const development = {
// VITE_APP_BASE_URL: 'http://47.100.31.83:8081',
VITE_APP_BASE_URL: 'http://47.100.31.83:8081', VITE_APP_BASE_URL: 'http://47.100.31.83:8081',
appid: '', appid: '',
} }

View File

@ -62,7 +62,10 @@
"setting": { "setting": {
"urlCheck": false "urlCheck": false
}, },
"usingComponents": true "usingComponents": true,
"optimization": {
"subPackages": true //
}
}, },
"mp-alipay": { "mp-alipay": {
"usingComponents": true "usingComponents": true

View File

@ -33,30 +33,6 @@
// "navigationBarTitleText": "工作台" // "navigationBarTitleText": "工作台"
// } // }
// }, // },
{
"path": "pages/index/pricing",
"style": {
"navigationBarTitleText": "待定价"
}
},
{
"path": "pages/index/tareing",
"style": {
"navigationBarTitleText": "待过皮重"
}
},
{
"path": "pages/index/payReview",
"style": {
"navigationBarTitleText": "付款审核"
}
},
{
"path": "pages/index/shipmenting",
"style": {
"navigationBarTitleText": "待出货"
}
},
{ {
"path": "pages/index/grossWeight", "path": "pages/index/grossWeight",
"style": { "style": {
@ -69,12 +45,6 @@
"navigationBarTitleText": "出货结算" "navigationBarTitleText": "出货结算"
} }
}, },
{
"path": "pages/review/index",
"style": {
"navigationBarTitleText": "去审核"
}
},
{ {
"path": "pages/index/settlement", "path": "pages/index/settlement",
"style": { "style": {
@ -167,12 +137,6 @@
"navigationBarTitleText": "客户对账" "navigationBarTitleText": "客户对账"
} }
}, },
{
"path": "pages/scenePhoto/index",
"style": {
"navigationBarTitleText": "现场照片"
}
},
{ {
"path": "pages/statistics/supplier/billDetail", "path": "pages/statistics/supplier/billDetail",
"style": { "style": {
@ -244,9 +208,75 @@
"style": { "style": {
"navigationBarTitleText": "客户管理" "navigationBarTitleText": "客户管理"
} }
}, }
//pageshttps://uniapp.dcloud.io/collocation/pages //pageshttps://uniapp.dcloud.io/collocation/pages
], ],
"subPackages": [
{
"root": "pagesReceive",
"pages": [
{
"path": "pricing",
"style": {
"navigationBarTitleText": "待定价"
}
},
{
"path": "tareing",
"style": {
"navigationBarTitleText": "待过皮重"
}
},
{
"path": "payReview",
"style": {
"navigationBarTitleText": "付款审核"
}
},
{
"path": "form/pricingForm",
"style": {
"navigationBarTitleText": "定价详情"
}
},
{
"path": "review/index",
"style": {
"navigationBarTitleText": "去审核"
}
}
]
},
{
"root": "pagesShipment",
"pages": [
{
"path": "shipmenting",
"style": {
"navigationBarTitleText": "待出货"
}
},
{
"path": "form/shipmentForm",
"style": {
"navigationBarTitleText": "待出货编辑"
}
}
]
},{
"root": "pagesScenePhoto",
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "现场照片"
}
}
]
}
],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "智能回收", "navigationBarTitleText": "智能回收",

View File

@ -105,7 +105,7 @@ const gridList1 = reactive([
]); ]);
const handleScenePhoto = () => { const handleScenePhoto = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/scenePhoto/index", // url: "/pagesScenePhoto/index", //
}); });
}; };
</script> </script>

View File

@ -114,7 +114,7 @@ const gridList1 = reactive([
]); ]);
const handleScenePhoto = () => { const handleScenePhoto = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/scenePhoto/index", // url: "/pagesScenePhoto/index", //
}); });
}; };
</script> </script>

View File

@ -154,7 +154,7 @@ const gridList1 = reactive([
]); ]);
const handleScenePhoto = () => { const handleScenePhoto = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/scenePhoto/index", // url: "/pagesScenePhoto/index", //
}); });
}; };
</script> </script>

View File

@ -145,7 +145,7 @@ const gridList1 = reactive([
]); ]);
const handleScenePhoto = () => { const handleScenePhoto = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/scenePhoto/index", // url: "/pagesScenePhoto/index", //
}); });
}; };
</script> </script>

View File

@ -4,7 +4,6 @@
<view> <view>
<view> <view>
<text class="address">上海奉贤两网融合</text> <text class="address">上海奉贤两网融合</text>
<text class="type">(大磅)</text>
</view> </view>
<view> <view>
<text class="number">收货单号SHD20230901132333</text> <text class="number">收货单号SHD20230901132333</text>
@ -14,7 +13,7 @@
</view> </view>
</view> </view>
<view> <view>
<text class="btn">现场照片</text> <text class="btn" @click="handleScenePhoto">现场照片</text>
</view> </view>
</view> </view>
<view> <view>
@ -33,7 +32,13 @@
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"></script> <script setup lang="ts">
const handleScenePhoto = () => {
uni.navigateTo({
url: "/pagesScenePhoto/index", //
});
};
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.card-box { .card-box {
padding: 38rpx 50rpx; padding: 38rpx 50rpx;
@ -43,44 +48,40 @@
margin-top: 35rpx; margin-top: 35rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 26rpx;
color: #000000; color: #000000;
line-height: 41rpx; line-height: 41rpx;
.top-flex-box { .top-flex-box {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
line-height: 50rpx;
.btn { .btn {
border-radius: 24rpx; border-radius: 24rpx;
border: 1px solid #00dcee; border: 1px solid #00dcee;
padding: 10rpx 30rpx; padding: 10rpx 25rpx;
font-weight: 500; font-weight: 500;
font-size: 24rpx; font-size: 24rpx;
color: #00dcee; color: #00dcee;
line-height: 41rpx; line-height: 41rpx;
display: inline-block;
} }
} }
.address {
margin-right: 30rpx;
}
.type,
.desc { .desc {
font-size: 21rpx; font-size: 24rpx;
color: #999999; color: #999999;
}
.desc {
margin-top: 30rpx; margin-top: 30rpx;
display: inline-block; display: inline-block;
} }
.name { .name {
font-size: 32rpx; font-size: 28rpx;
color: #000000; color: #000000;
font-weight: bold;
} }
.flex-box { .flex-box {
font-weight: 400; font-weight: 400;
font-size: 32rpx; font-size: 28rpx;
color: #000000; color: #000000;
line-height: 41rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;

View File

@ -212,7 +212,7 @@ const receiveList = reactive([
num: 0, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/pricing", // url: "/pagesReceive/pricing", //
}); });
}, },
}, },
@ -221,7 +221,7 @@ const receiveList = reactive([
num: 0, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/tareing", // url: "/pagesReceive/tareing", //
}); });
}, },
}, },
@ -230,7 +230,7 @@ const receiveList = reactive([
num: 0, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/payReview", // url: "/pagesReceive/payReview?scaleStatus=2", //
}); });
}, },
}, },
@ -239,7 +239,7 @@ const receiveList = reactive([
num: 0, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/payReview", // url: "/pagesReceive/payReview?scaleStatus=3", //
}); });
}, },
}, },
@ -247,16 +247,16 @@ const receiveList = reactive([
const shipmentList = reactive([ const shipmentList = reactive([
{ {
title: "待出货", title: "待出货",
num: 999, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/shipmenting", // url: "/pagesShipment/shipmenting", //
}); });
}, },
}, },
{ {
title: "待过毛重", title: "待过毛重",
num: 999, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/grossWeight", // url: "/pages/index/grossWeight", //
@ -265,19 +265,19 @@ const shipmentList = reactive([
}, },
{ {
title: "出货结算", title: "出货结算",
num: 999, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/payReview", // url: "/pagesReceive/payReview", //
}); });
}, },
}, },
{ {
title: "待结算", title: "待结算",
num: 999, num: 0,
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/payReview", // url: "/pagesReceive/payReview", //
}); });
}, },
}, },
@ -465,7 +465,7 @@ onMounted(() => {
border-radius: 13rpx; border-radius: 13rpx;
position: relative; position: relative;
.title { .title {
font-size: 27rpx; font-size: 28rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 500; font-weight: 500;
color: #000000; color: #000000;
@ -516,7 +516,7 @@ onMounted(() => {
/* #endif */ /* #endif */
} }
.desc { .desc {
font-size: 24rpx; font-size: 26rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
color: #000000; color: #000000;
@ -537,7 +537,7 @@ onMounted(() => {
padding-bottom: 0rpx; padding-bottom: 0rpx;
.name { .name {
text-align: center; text-align: center;
font-size: 27rpx; font-size: 28rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 500; font-weight: 500;
color: #000000; color: #000000;
@ -546,7 +546,7 @@ onMounted(() => {
.grid-text { .grid-text {
margin-top: 17rpx; margin-top: 17rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
font-size: 24rpx; font-size: 26rpx;
} }
} }
} }

View File

@ -1,128 +0,0 @@
<template>
<view class="card-box">
<view class="top-flex-box">
<view>
<view>
<text class="address">上海奉贤两网融合</text>
<text class="type">(大磅)</text>
</view>
<view>
<text class="number">收货单号SHD20230901132333</text>
</view>
<view>
<text class="name">陡其成</text>
</view>
</view>
<view>
<text class="btn" @click="handleScenePhoto()">现场照片</text>
</view>
</view>
<view>
<text class="desc">毛重时间2023-09-01 13:23:33</text>
</view>
<view class="flex-box">
<text>毛重2510kg</text>
<text>单价未定价</text>
</view>
<view class="btn-box">
<u-button
text="点击作废"
color="#E8E8E8"
:customStyle="{ color: '#999' }"
@click="handleModal(true)"
></u-button>
<u-button type="primary" text="点击定价"></u-button>
</view>
</view>
<SmallModal :title="'确认作废吗?'" :content="'确认作废后,该订单不能恢复!'" :okText="'确认作废'" :isMain="true" :show="isShowCancelModal" @handleModal="(v:boolean) => {handleModal(v)}"/>
</template>
<script setup lang="ts">
import { ReceiveApi } from "@/services/index";
import SmallModal from '@/components/Modal/smallModal.vue'
const pageList = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const isShowCancelModal = ref(false)
const handleModal = (v: boolean) => {
isShowCancelModal.value = v
}
const handleScenePhoto = () => {
uni.navigateTo({
url: "/pages/scenePhoto/index", //
});
};
ReceiveApi.getOrderPage({ pageNumber: 1, pageSize: 10 }).then((res) => {
if (res.code === 200) {
(pageList as any).list = res.data.list;
}
});
</script>
<style lang="scss" scoped>
.card-box {
padding: 38rpx 50rpx;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 0rpx 25rpx;
margin-top: 35rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #000000;
line-height: 41rpx;
.top-flex-box {
display: flex;
justify-content: space-between;
align-items: center;
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
cursor: pointer;
}
}
.address {
margin-right: 30rpx;
}
.type,
.desc {
font-size: 21rpx;
color: #999999;
}
.desc {
margin-top: 30rpx;
display: inline-block;
}
.name {
font-size: 32rpx;
color: #000000;
}
.flex-box {
font-weight: 400;
font-size: 32rpx;
color: #000000;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.btn-box {
margin-top: 60rpx;
display: flex;
::v-deep button {
border-radius: 43rpx;
}
::v-deep button + button {
margin-left: 50rpx;
}
}
}
</style>

View File

@ -1,99 +0,0 @@
<template>
<view class="card-box">
<view class="top-flex-box">
<view>
<view>
<text class="address">上海奉贤两网融合</text>
<text class="type">(大磅)</text>
</view>
<view>
<text class="number">收货单号SHD20230901132333</text>
</view>
<view>
<text class="name">陡其成</text>
</view>
</view>
<view>
<text class="btn">现场照片</text>
</view>
</view>
<view>
<text class="desc">毛重时间2023-09-01 13:23:33</text>
</view>
<view class="flex-box">
<text>皮重2510kg</text>
</view>
<view class="btn-box">
<u-button
text="点击作废"
color="#E8E8E8"
:customStyle="{ color: '#999' }"
></u-button>
<u-button type="primary" text="点击编辑"></u-button>
</view>
</view>
</template>
<script setup lang="ts"></script>
<style lang="scss" scoped>
.card-box {
padding: 38rpx 50rpx;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 0rpx 25rpx;
margin-top: 35rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #000000;
line-height: 41rpx;
.top-flex-box {
display: flex;
justify-content: space-between;
align-items: center;
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
}
}
.address {
margin-right: 30rpx;
}
.type,
.desc {
font-size: 21rpx;
color: #999999;
}
.desc {
margin-top: 30rpx;
display: inline-block;
}
.name {
font-size: 32rpx;
color: #000000;
}
.flex-box {
font-weight: 400;
font-size: 32rpx;
color: #000000;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.btn-box {
margin-top: 60rpx;
display: flex;
::v-deep button {
border-radius: 43rpx;
}
::v-deep button + button {
margin-left: 50rpx;
}
}
}
</style>

View File

@ -1,100 +0,0 @@
<template>
<view class="card-box">
<view class="top-flex-box">
<view>
<view>
<text class="address">上海奉贤两网融合</text>
<text class="type">(大磅)</text>
</view>
<view>
<text class="number">收货单号SHD20230901132333</text>
</view>
<view>
<text class="name">陡其成</text>
</view>
</view>
<view>
<text class="btn">现场照片</text>
</view>
</view>
<view>
<text class="desc">毛重时间2023-09-01 13:23:33</text>
</view>
<view class="flex-box">
<text>毛重2510kg</text>
<text>单价5/kg</text>
</view>
<view class="btn-box">
<u-button
text="点击作废"
color="#E8E8E8"
:customStyle="{ color: '#999' }"
></u-button>
<u-button type="primary" text="点击编辑"></u-button>
</view>
</view>
</template>
<script setup lang="ts"></script>
<style lang="scss" scoped>
.card-box {
padding: 38rpx 50rpx;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 0rpx 25rpx;
margin-top: 35rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #000000;
line-height: 41rpx;
.top-flex-box {
display: flex;
justify-content: space-between;
align-items: center;
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
}
}
.address {
margin-right: 30rpx;
}
.type,
.desc {
font-size: 21rpx;
color: #999999;
}
.desc {
margin-top: 30rpx;
display: inline-block;
}
.name {
font-size: 32rpx;
color: #000000;
}
.flex-box {
font-weight: 400;
font-size: 32rpx;
color: #000000;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.btn-box {
margin-top: 60rpx;
display: flex;
::v-deep button {
border-radius: 43rpx;
}
::v-deep button + button {
margin-left: 50rpx;
}
}
}
</style>

View File

@ -1,95 +0,0 @@
<template>
<view class="c-login-container">
<view>
<u-form labelPosition="left" :model="model1" :rules="rules" ref="loginForm" :labelWidth="0">
<u-form-item prop="userInfo.name" ref="item1">
<u-input
v-model="model1.userInfo.name"
placeholder="请输入手机号"
:shape="'circle'"
></u-input>
</u-form-item>
<u-form-item prop="userInfo.name" ref="item1">
<u-input
v-model="model1.userInfo.name"
placeholder="请输入验证码"
:shape="'circle'"
>
<template #suffix>
<text>获取验证码</text>
</template>
</u-input>
</u-form-item>
<u-form-item prop="userInfo.name" ref="item1">
<u-input
v-model="model1.userInfo.name"
placeholder="请设置密码"
:shape="'circle'"
:type="'password'"
></u-input>
</u-form-item>
<u-form-item>
<view class="c-flex-space-between">
<u-checkbox-group
v-model="checkboxValue1"
placement="column"
@change="checkboxChange"
>
<u-checkbox
:customStyle="{ fontSize: '8px' }"
:key="'1'"
:label="'记住密码'"
:name="'记住密码'"
/>
</u-checkbox-group>
<text class="f-s-15 l-h-28">无法收到验证码</text>
</view>
</u-form-item>
</u-form>
<u-button @click="submit">立即登录</u-button>
</view>
</view>
</template>
<script setup lang="ts">
const loginForm = ref(null);
const checkboxValue1 = ref([]);
const model1 = ref({
userInfo: {
name: "",
sex: "",
},
});
const rules = ref({
"userInfo.name": {
type: "string",
required: true,
message: "请填写姓名",
trigger: ["blur", "change"],
},
"userInfo.sex": {
type: "string",
max: 1,
required: true,
message: "请选择男或女",
trigger: ["blur", "change"],
},
});
const checkboxChange = (n: any) => {
console.log("change", n);
};
const submit = () => {
(loginForm.value as any).validate();
};
</script>
<style lang="scss" scoped>
.c-flex-space-between {
display: flex;
justify-content: space-between;
width: 100%;
font-size: 12px;
}
</style>

View File

@ -163,9 +163,6 @@ const submit = () => {
}); });
} }
}); });
uni.navigateTo({
url: "/pages/index/index", //
});
}; };
const handleForgetPwd = () => { const handleForgetPwd = () => {
uni.navigateTo({ uni.navigateTo({

View File

@ -1,257 +0,0 @@
<template>
<view class="c-card">
<view class="box" v-for="item in 1" :key="item">
<view class="base">
<view>
<view class="supplier"> 上海奉贤两网融合大磅 </view>
</view>
</view>
<view class="flex-box1">
<view class="type">轻二</view>
<view class="btn">
<view
><u-tag
text="现场照片"
plain
shape="circle"
:bgColor="'rgba(237, 254, 255, 1)'"
></u-tag
></view>
<view
><u-tag
text="收货单作废"
plain
shape="circle"
:borderColor="'rgba(255, 147, 68, 1) !important'"
:bgColor="'rgba(255, 240, 229, 1)'"
:color="'rgba(255, 157, 85, 1) !important'"
></u-tag
></view>
<view
><u-tag
text="编辑信息"
plain
shape="circle"
:borderColor="'rgba(0, 238, 78, 1) !important'"
:bgColor="'rgba(227, 255, 236, 1)'"
:color="'rgba(0, 238, 78, 1) !important'"
></u-tag
></view>
</view>
</view>
<view class="flex-box">
<text>定价人谭兵</text>
<text>创建时间2023-09-01 13:23:33</text>
</view>
<view class="more">
<view v-for="(item, index) in gridList1" :key="index">
<text v-if="item.name">{{ item.name }}</text
><text
>{{ item.isBefore ? item.unit : "" }}
{{ item.num }}
{{ item.isBefore ? "" : item.unit }}
</text>
</view>
</view>
</view>
<view class="op-btn">
<view class="c-btn-review">
<view> 审核暂不支付 </view>
<view class="active"> 审核立即支付 </view>
</view>
<view>
<u-button
text="重新过皮"
plain
:customStyle="{
color: 'rgba(0, 220, 238, 1)',
border: '1px solid #00DCEE',
'border-radius': '43rpx',
}"
></u-button>
</view>
<view>
<u-button
text="打印"
type="primary"
:customStyle="{ 'border-radius': '43rpx' }"
></u-button>
</view>
</view>
</view>
</template>
<script setup lang="ts">
const keyword = ref("");
const gridList1 = reactive([
{
name: "毛重",
num: "4080.00",
unit: "KG",
isBefore: false,
},
{
name: "皮重",
num: "3450.00",
unit: "KG",
isBefore: false,
},
{
name: "扣杂",
num: "640.00",
unit: "KG",
isBefore: false,
},
{},
{
name: "净重",
num: "640.00",
unit: "KG",
isBefore: false,
},
{
name: "单价",
num: "2.48",
unit: "元/千克",
isBefore: false,
},
{
name: "预估总价",
num: "2.48",
unit: "元",
isBefore: false,
},
{
name: "贷款总价",
num: "2.48",
unit: "元",
isBefore: false,
},
]);
const handleScenePhoto = () => {
uni.navigateTo({
url: "/pages/scenePhoto/index", //
});
};
</script>
<style lang="scss" scoped>
.c-card {
margin: 30rpx 25rpx;
.box {
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
padding: 30rpx;
.base {
display: flex;
align-items: center;
justify-content: space-between;
.no {
font-weight: 400;
font-size: 21rpx;
color: #000000;
}
.supplier {
font-weight: 400;
font-size: 24rpx;
color: #000000;
}
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
}
}
.name {
font-weight: 400;
font-size: 27rpx;
color: #000000;
margin: 15rpx 0rpx;
text {
background-color: #ffaf75;
font-weight: 500;
font-size: 16rpx;
color: #ffffff;
padding: 5rpx 20rpx;
margin-left: 20rpx;
}
}
.flex-box1 {
display: flex;
align-items: center;
justify-content: space-between;
margin: 20rpx 0rpx;
.type {
font-weight: 400;
font-size: 27rpx;
color: #ec0f3e;
}
.btn {
display: flex;
> view + view {
margin-left: 10rpx;
}
}
}
.flex-box {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 400;
font-size: 24rpx;
color: #999999;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
padding-bottom: 20rpx;
}
}
.more {
display: grid;
grid-template-columns: repeat(2, 1fr);
flex: 1;
font-weight: 400;
font-size: 24rpx;
color: #000000;
padding: 25rpx 0rpx 0rpx 0rpx;
> view {
line-height: 50rpx;
}
}
.op-btn {
width: 80%;
margin: 0px auto;
margin-top: 100rpx;
.c-btn-review {
display: flex;
justify-content: space-between;
align-items: center;
background: #f5f5f5;
border-radius: 38rpx;
text-align: center;
margin-bottom: 80rpx;
> view {
width: 50%;
text-align: center;
font-weight: 500;
font-size: 27rpx;
color: #999999;
}
.active {
background: #00dcee;
border-radius: 38rpx;
font-weight: 500;
font-size: 27rpx;
color: #ffffff;
padding: 20rpx 30rpx;
}
}
> view + view {
margin-top: 30rpx;
}
}
}
</style>

View File

@ -1,62 +0,0 @@
<template>
<view class="layout">
<view class="name">现场照片</view>
<view class="time">2024-01-22 14:28:36</view>
<up-row customStyle="flex-wrap: wrap">
<up-col span="6" v-for="(item, index) in 10" :key="item">
<view
class="grid-item"
:style="{
marginLeft: index % 2 === 1 ? '10rpx' : '',
marginRight: index % 2 === 0 ? '10rpx' : '',
marginBottom: '10rpx'
}"
>
<text class="tip">毛重过磅</text>
<image src="/static/img/temp/car.png" mode="'heightFix'" />
</view>
</up-col>
</up-row>
</view>
</template>
<script setup lang="ts"></script>
<style lang="scss" scoped>
.layout {
margin: 22.44rpx 26.54rpx;
padding: 33rpx 18rpx;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
font-family: Source Han Sans CN;
.name {
font-weight: 400;
font-size: 24rpx;
color: #000000;
line-height: 41rpx;
}
.time {
font-weight: 400;
font-size: 21rpx;
color: #999999;
line-height: 41rpx;
}
.grid-item {
position: relative;
image {
width: 100%;
}
.tip {
background: rgba(0, 0, 0, 0.63);
box-shadow: 0rpx 0rpx 6rpx 0rpx rgba(0, 0, 0, 0.09);
border-radius: 0rpx 40rpx 40rpx 0rpx;
font-weight: 400;
font-size: 21rpx;
color: #ffffff;
padding: 10rpx 30rpx;
position: absolute;
margin-top: 40rpx;
}
}
}
</style>

View File

@ -140,7 +140,7 @@ const gridList2 = reactive([
]); ]);
const handleScenePhoto = () => { const handleScenePhoto = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/scenePhoto/index", // url: "/pagesScenePhoto/index", //
}); });
}; };
</script> </script>

View File

@ -96,7 +96,7 @@ const gridList1 = reactive([
]); ]);
const handleScenePhoto = () => { const handleScenePhoto = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/scenePhoto/index", // url: "/pagesScenePhoto/index", //
}); });
}; };
</script> </script>

View File

@ -0,0 +1,422 @@
<template>
<view class="c-card">
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }"
>
<u-form-item
:prop="`order[${item.key}]`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-textarea
v-if="item.type === 'textarea'"
v-model="(model1.order as any)[item.key]"
:placeholder="`请输入${item.name}`"
></u-textarea>
<u-input
v-if="item.type === 'select' || item.type === 'input'"
v-model="(model1.order as any)[item.key]"
:placeholder="`${item.type === 'select' ? '选择' : '输入'}${
item.name
}`"
:clearable="true"
:customStyle="{}"
border="none"
>
<template #suffix>
<text v-if="item.key === 'subtractNum'">
{{ model1.order.buttonType === 0 ? item.unit : "%" }}
</text>
<text v-else>
{{ item.unit }}
</text>
</template>
</u-input>
<!-- @afterRead="afterRead"
@delete="deletePic" -->
<uni-file-picker
v-if="item.type === 'upload'"
v-model="model1.order.fileList"
limit="10"
title="最多可上传10张图片"
:auto-upload="false"
fileMediatype="image"
mode="grid"
ref="filesRef"
></uni-file-picker>
<u-radio-group
v-if="item.type === 'radio'"
v-model="(model1.order as any)[item.key]"
placement="row"
>
<u-radio
v-for="(c, index) in item.child"
:key="index"
activeColor="#00DCEE"
:label="c.name"
:name="c.id"
:customStyle="{ marginRight: '10px' }"
></u-radio>
</u-radio-group>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right"></u-icon>
</template>
</u-form-item>
</u-form>
<block v-for="(item, index) in formAttrList" :key="index">
<u-action-sheet
v-if="item.type === 'select'"
:actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow"
@select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
</view>
<view class="btn-box">
<u-button text="暂不定价"></u-button>
<u-button type="primary" text="保存" @click="save()"></u-button>
</view>
</template>
<script setup lang="ts">
import type { ComType } from "@/types/global";
import {
ProfileApi,
ReceiveProductApi,
ReceiveApi,
PictureApi,
} from "@/services/index";
import _ from "underscore";
import { onLoad } from "@dcloudio/uni-app";
import { ImagesType, OrderType } from "@/utils/enum";
const model1 = reactive<{ order: Order }>({
order: {
id: 0,
userName: "", //
userId: "", // Id,
carNumber: "",
productId: "", // Id,
productName: "", //
price: "", //
buttonType: 0, // 01
weighingMethod: 0, // 0 1
multiCategory: 0, // 0 1
fileList: [],
scaleStatus: 1,
},
});
const rules = ref({
"userInfo.userName": {
type: "string",
required: true,
message: "请输入手机号",
trigger: ["blur", "change"],
},
"userInfo.password": {
type: "string",
required: true,
message: "请输入密码",
trigger: ["blur", "change"],
},
});
const contrlModalParams = reactive<ComType>({
isShowSplTime: false,
spltime: "",
userSelect: {
isShow: false,
title: "标题",
list: [],
},
productSelect: {
isShow: false,
title: "标题",
list: [],
},
});
const formAttrList = reactive<ComType>([
{
name: "供应商",
key: "userName",
type: "select",
unit: "",
childKey: "userSelect",
required: true,
fn: () => {
contrlModalParams.userSelect.isShow = true;
contrlModalParams.userSelect.title = "供应商";
},
},
{
name: "车牌号",
key: "carNumber",
type: "input",
unit: "",
},
{
name: "收货产品",
key: "productName",
type: "select",
unit: "",
childKey: "productSelect",
required: true,
fn: () => {
contrlModalParams.productSelect.isShow = true;
contrlModalParams.productSelect.title = "收货产品";
},
},
{
name: "单价",
key: "price",
type: "input",
unit: "元/KG",
required: true,
},
{
name: "毛重",
key: "grossWeight",
type: "input",
unit: "KG",
required: true,
},
{
name: "扣杂",
key: "buttonType",
type: "radio",
child: [
{
id: 0,
name: "按固定重量",
},
{
id: 1,
name: "按百分比",
},
],
},
{
name: "杂质扣除",
key: "subtractNum",
type: "input",
unit: "KG",
},
{
name: "称重方式",
key: "weighingMethod",
type: "radio",
required: true,
child: [
{
id: 0,
name: "有皮重",
},
{
id: 1,
name: "零皮重",
},
],
},
{
name: "多品类",
key: "multiCategory",
type: "radio",
required: true,
child: [
{
id: 0,
name: "单品类",
},
{
id: 1,
name: "多品类",
},
],
},
{
name: "备注",
key: "notes",
type: "textarea",
},
{
name: "货品照片",
key: "photo",
type: "upload",
},
]);
ProfileApi.getUserList({ userType: 2 }).then((res) => {
if (res.code === 200) {
contrlModalParams.userSelect.list = res.data;
}
});
ReceiveProductApi.getAllReProducts().then((res) => {
if (res.code === 200) {
contrlModalParams.productSelect.list = _.map(
res.data as any,
function (item: any) {
return { name: item.reProductsName, ...item };
}
);
}
});
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "userSelect") {
model1.order.userName = v.name;
model1.order.userId = v.id;
} else if (key === "productSelect") {
model1.order.productName = v.name;
model1.order.productId = v.id;
}
};
onLoad((option) => {
model1.order.id = parseInt((option as any).id);
if (model1.order.id) {
ReceiveApi.getDetailById({ id: model1.order.id }).then((res) => {
if (res.code === 200) {
model1.order = res.data;
}
});
PictureApi.getAnnex({
businessId: model1.order.id,
orderType: 1,
imagesType: ImagesType.NORMARL,
}).then((res) => {
if (res.code === 200) {
}
});
}
});
// const files = ref<FileObj[]>([]);
const filesRef = ref();
const handleUpload = () => {
// console.log(event.tempFilePaths)
const list = filesRef.value[0].filesList;
return list.map((item: any) => {
return new Promise((resolve) => {
PictureApi.upload({
files: item,
path: item.path,
}).then((res) => {
if (res.code === 200) {
resolve({
...(res.data as any),
businessId: model1.order.id,
imagesType: ImagesType.NORMARL, //
orderType: OrderType.Receive, //
});
}
});
});
});
};
/**
* 点击保存 先执行upload接口
* 上传成功后 保存图片资源 和更新订单数据
*/
const save = () => {
Promise.all(handleUpload()).then((res) => {
//
if (res.length > 0) {
PictureApi.addListAnnex({ annexPos: res }).then((res1) => {
if (res1.code === 200) {
uni.showToast({
title: "图片资源上传成功",
icon: "success",
});
}
});
}
});
//
/**
* 0有皮重 1零皮重
* 有皮重 scaleState = 1 带过皮
零皮重 scaleState = 2 带审核
*/
if (model1.order.weighingMethod === 0) {
model1.order.scaleStatus = 1;
} else if (model1.order.weighingMethod === 1) {
model1.order.scaleStatus = 2;
}
//
/**
* buttonType
* 0扣杂1扣点
* buttonType===0 buckleMiscellaneous
* buttonType===1 points
*
*/
if (model1.order.buttonType === 0) {
model1.order.buckleMiscellaneous = model1.order.subtractNum;
} else if (model1.order.buttonType === 1) {
model1.order.points = model1.order.subtractNum;
}
ReceiveApi.updateOne({ ...model1.order }).then((res) => {
if (res.code === 200) {
// - ->
uni.showToast({
title: "定价成功",
icon: "success",
});
// 0 1
if (model1.order.weighingMethod === 0) {
uni.navigateTo({
url: "/pagesReceive/tareing", //
});
} else if (model1.order.weighingMethod === 1) {
uni.navigateTo({
url: "/pages/index/payReview", //
});
}
}
});
};
</script>
<style lang="scss" scoped>
.c-card {
background: #ffffff;
// box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 30rpx 25rpx;
padding: 10rpx 20rpx;
::v-deep .u-form-item {
height: auto;
}
::v-deep .u-form-item + .u-form-item {
border-top: 1rpx solid rgba(233, 233, 233, 0.76);
}
}
.btn-box {
margin-top: 60rpx;
display: flex;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12);
border-radius: 13rpx 13rpx 0rpx 0rpx;
padding: 25rpx 50rpx;
position: sticky;
bottom: 0rpx;
z-index: 999;
::v-deep button {
border-radius: 43rpx;
}
::v-deep button + button {
margin-left: 30rpx;
}
}
</style>

View File

@ -21,90 +21,147 @@
<text <text
v-for="(item, index) in tabList" v-for="(item, index) in tabList"
:key="index" :key="index"
:class="{ active: currentTab === item.name }" :class="{ active: currentTab === item.key }"
@click="handleTab(item)" @click="handleTab(item)"
> >
{{ item.name }} {{ item.name }}
</text> </text>
</view> </view>
<block v-for="item in 10" :key="item"> <block v-for="(item, index) in pageList.list" :key="index">
<view class="c-layout"> <view class="c-layout">
<view <view
><checkbox ><checkbox
value="cb" value="cb"
:color="'#00D2E3'" :color="'#00D2E3'"
:checked="true" :checked="state.checkMap[(item.id as number)]"
style="transform: scale(0.5)" style="transform: scale(0.5)"
/></view> /></view>
<view class="inner-box"> <view class="inner-box">
<view class="top-flex-box"> <view class="top-flex-box">
<view> <view>
<view> <view>
<text class="number">收货单号SHD20230901132333</text> <text class="number">收货单号{{ item.receiptNumber }}</text>
</view> </view>
<view> <view>
<text class="name">陡其成</text> <text class="name">{{ item.userName }}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="bottom-flex-box"> <view class="bottom-flex-box">
<view> <view>
<view> <view>
<text class="desc">过磅总净重1870.00KG</text> <text class="desc"
>过磅总净重{{ item.netWeight || 0 }}KG</text
>
</view> </view>
<view class="flex-box"> <view class="flex-box">
<text>贷款金额2510.00</text> <text>货款金额{{ item.totalPrice || 0 }}</text>
</view> </view>
</view> </view>
<view> <view>
<text class="btn"> <text class="btn">
<text v-if="currentTab === '等待审核'" @click="handleReview" <text
v-if="currentTab === 2"
@click="handleReview(item.id as number, 2)"
>去审核</text >去审核</text
> >
<text v-if="currentTab === '已审未付'">去支付</text> <text v-if="currentTab === 3" @click="handleReview(item.id as number, 3)">去支付</text>
<text v-if="currentTab === '已审已付'">查看</text> <text v-if="currentTab === 4" @click="handleReview(item.id as number, 4)">查看</text>
</text> </text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<u-gap
<view class="line" v-show="item !== 10"> </view> height="10"
bgColor="#f8f8f8"
v-if="index < pageList.list.length - 1"
></u-gap>
</block> </block>
</view> </view>
<view class="btn-box"> <view class="btn-box" v-if="(currentTab === 2 || currentTab === 3) && pageList.list.length > 0">
<u-button <u-button
text="全选/取消" text="全选/取消"
color="#fff" color="#fff"
:customStyle="{ color: '#00DCEE', border: '1px solid #00DCEE' }" :customStyle="{ color: '#00DCEE', border: '1px solid #00DCEE' }"
@click="handleSelect"
></u-button> ></u-button>
<u-button type="primary" text="批量审核"></u-button> <u-button type="primary" :text="`${currentTab === 2 ? '批量审核' : '批量支付'}`"></u-button>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ReceiveApi } from "@/services/index";
import { onLoad } from "@dcloudio/uni-app";
// scaleStatus
interface PageResult<T> {
total: number;
list: T[];
pageNum: number;
pageSize: number;
}
const pageList: PageResult<Order> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const keyword = ref(); const keyword = ref();
const isShowSearch = ref(false); const isShowSearch = ref(false);
const state = reactive<{
[attrName: string]: any;
}>({
checkMap: {},
isAll: false,
});
const tabList = reactive([ const tabList = reactive([
{ {
name: "等待审核", name: "等待审核",
key: 2,
}, },
{ {
name: "已审未付", name: "已审未付",
key: 3,
}, },
{ {
name: "已审已付", name: "已审已付",
key: 4,
}, },
]); ]);
const currentTab = ref("等待审核"); const currentTab = ref(2);
const handleTab = (item: any) => { const handleTab = (item: any) => {
currentTab.value = item.name; currentTab.value = item.key;
getOrderList();
}; };
const handleReview = () => { const handleReview = (id: number, scaleStatus: number) => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/review/index", // url: "/pagesReceive/review/index?id=" + id + `&scaleStatus=`+ scaleStatus, //
}); });
}; };
const handleSelect = () => {
state.isAll = !state.isAll;
Object.keys(state.checkMap).forEach((item) => {
state.checkMap[item] = state.isAll;
});
};
const getOrderList = () => {
ReceiveApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: currentTab.value }).then(
(res) => {
if (res.code === 200) {
(pageList as any).list = res.data.list;
(res.data.list as any).forEach((item: any) => {
state.checkMap[parseInt(item.id)] = false;
});
}
}
);
};
onMounted(() => {
getOrderList();
});
onLoad((option) => {
currentTab.value = parseInt((option as any).scaleStatus);
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.search { .search {
@ -115,7 +172,7 @@ const handleReview = () => {
margin: 0px auto; margin: 0px auto;
margin-top: 30rpx; margin-top: 30rpx;
font-weight: 400; font-weight: 400;
font-size: 27rpx; font-size: 26rpx;
color: #c1c1c1; color: #c1c1c1;
> view { > view {
line-height: 60rpx; line-height: 60rpx;
@ -131,7 +188,7 @@ const handleReview = () => {
.c-tab { .c-tab {
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 27rpx; font-size: 26rpx;
color: #999999; color: #999999;
line-height: 41rpx; line-height: 41rpx;
display: flex; display: flex;
@ -171,39 +228,29 @@ const handleReview = () => {
} }
} }
.line {
height: 18rpx;
background: #f8f8f8;
}
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12); box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx; border-radius: 13rpx;
margin: 0rpx 25rpx; margin: 0rpx 25rpx;
margin-top: 35rpx; margin-top: 35rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 26rpx;
color: #000000; color: #000000;
line-height: 41rpx; line-height: 41rpx;
.address {
margin-right: 30rpx;
}
.type,
.desc { .desc {
font-size: 21rpx; font-size: 24rpx;
color: #999999; color: #999999;
}
.desc {
margin-top: 30rpx; margin-top: 30rpx;
display: inline-block; display: inline-block;
} }
.name { .name {
font-size: 32rpx; font-size: 26rpx;
color: #000000; color: #000000;
font-weight: bold;
} }
.flex-box { .flex-box {
font-weight: 400; font-weight: bold;
font-size: 32rpx;
color: #000000; color: #000000;
line-height: 41rpx; line-height: 41rpx;
display: flex; display: flex;
@ -218,7 +265,7 @@ const handleReview = () => {
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12); box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12);
border-radius: 13rpx 13rpx 0rpx 0rpx; border-radius: 13rpx 13rpx 0rpx 0rpx;
padding: 25rpx 50rpx; padding: 25rpx 50rpx;
position: sticky; position: absolute;
bottom: 0rpx; bottom: 0rpx;
width: calc(100vw - 100rpx); width: calc(100vw - 100rpx);
::v-deep button { ::v-deep button {

View File

@ -0,0 +1,166 @@
<template>
<view class="card-box" v-for="(item, index) in pageList.list" :key="index">
<view class="top-flex-box">
<view>
<view>
<text class="address">{{ item.deviceName || "-" }}</text>
</view>
<view>
<text class="number">收货单号{{ item.receiptNumber }}</text>
</view>
<view>
<text class="name">{{ item.userName }}</text>
</view>
</view>
<view>
<text class="btn" @click="handleScenePhoto((item.imagesId as number))"
>现场照片</text
>
</view>
</view>
<view>
<text class="desc">过毛时间{{ item.grossTime }}</text>
</view>
<view class="flex-box">
<text>毛重{{ item.grossWeight }}kg</text>
<text>单价未定价</text>
</view>
<view class="btn-box">
<u-button
text="点击作废"
color="#E8E8E8"
:customStyle="{ color: '#999' }"
@click="handleModal(true, (item.id as number))"
></u-button>
<u-button
type="primary"
text="点击定价"
@click="pricingDetail((item.id as number))"
></u-button>
</view>
</view>
<SmallModal
:title="'确认作废吗?'"
:content="'确认作废后,该订单不能恢复!'"
:okText="'确认作废'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import { ReceiveApi } from "@/services/index";
import SmallModal from "@/components/Modal/smallModal.vue";
interface PageResult<T> {
total: number;
list: T[];
pageNum: number;
pageSize: number;
}
const pageList: PageResult<Order> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const isShowCancelModal = ref(false);
const deleteId = ref(0);
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleScenePhoto = (imagesId: number) => {
uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&id=" + imagesId, //
});
};
const pricingDetail = (id: number) => {
uni.navigateTo({
url: "/pagesReceive/form/pricingForm?id=" + id, //
});
};
const getOrderList = () => {
ReceiveApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: 0 }).then((res) => {
if (res.code === 200) {
(pageList as any).list = res.data.list;
}
});
};
const handleOk = () => {
console.log(deleteId.value);
ReceiveApi.deleteOrder({ids:[deleteId.value]}).then((res) => {
if (res.code === 200) {
getOrderList();
}
});
};
onMounted(() => {
getOrderList();
});
</script>
<style lang="scss" scoped>
.card-box {
padding: 38rpx 50rpx;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 0rpx 25rpx;
margin-top: 35rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
.top-flex-box {
display: flex;
justify-content: space-between;
align-items: center;
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
cursor: pointer;
}
}
.address {
margin-right: 30rpx;
}
.desc {
font-size: 24rpx;
color: #999999;
margin-top: 30rpx;
display: inline-block;
}
.name {
font-size: 26rpx;
color: #000000;
font-weight: bold;
}
.flex-box {
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.btn-box {
margin-top: 60rpx;
display: flex;
::v-deep button {
border-radius: 43rpx;
}
::v-deep button + button {
margin-left: 50rpx;
}
}
}
</style>

View File

@ -0,0 +1,452 @@
<template>
<view class="c-card">
<view class="box">
<view class="base">
<view>
<view class="supplier"> {{ state.order.deviceName || "-" }} </view>
</view>
</view>
<view class="flex-box1">
<view class="type">{{ state.order.productName || "" }}</view>
<view class="btn">
<view
><u-tag
text="现场照片"
plain
shape="circle"
:bgColor="'rgba(237, 254, 255, 1)'"
@click="handleScenePhoto(state.order.imagesId as number)"
></u-tag
></view>
<view
><u-tag
text="收货单作废"
plain
shape="circle"
:borderColor="'rgba(255, 147, 68, 1) !important'"
:bgColor="'rgba(255, 240, 229, 1)'"
:color="'rgba(255, 157, 85, 1) !important'"
@click="handleModal(true, state.order.id as number)"
></u-tag
></view>
<!-- 待审核才会有编辑信息-->
<view v-if="state.order.scaleStatus === 2"
><u-tag
text="编辑信息"
plain
shape="circle"
:borderColor="'rgba(0, 238, 78, 1) !important'"
:bgColor="'rgba(227, 255, 236, 1)'"
:color="'rgba(0, 238, 78, 1) !important'"
@click="handleUpdateOrder"
></u-tag
></view>
</view>
</view>
<view class="flex-box" v-if="state.order.scaleStatus === 2">
<text>定价人{{ state.order.pricingUserName || "-" }}</text>
<text>创建时间{{ state.order.createTime }}</text>
</view>
<!-- 入库 过磅时间对应过毛时间 -->
<view class="flex-box" v-if="getIsShow()" style="border: none">
<text>过磅时间{{ state.order.grossTime || "-" }}</text>
</view>
<view class="flex-box" v-if="getIsShow()">
<text>定价人{{ state.order.pricingUserName || "-" }}</text>
<text>审核人{{ state.order.reviewerUserName || "-" }}</text>
</view>
<view class="more">
<view v-if="getIsShow()"> 收货单号SHD20230901132333 </view>
<view v-if="getIsShow()"></view>
<view v-for="(item, index) in gridList1" :key="index">
<text v-if="item.name">{{ item.name }}</text
><text
>{{ item.isBefore ? item.unit : "" }}
{{ item.num }}
{{ item.isBefore ? "" : item.unit }}
</text>
</view>
</view>
</view>
<view class="op-btn">
<view class="c-btn-review" v-if="state.order.scaleStatus === 2">
<view @click="handleReviewNoPay"> 审核暂不支付 </view>
<view class="active" @click="handleReviewPay"> 审核立即支付 </view>
</view>
<view v-if="state.order.scaleStatus === 2">
<u-button
text="重新过皮"
plain
:customStyle="{
color: 'rgba(0, 220, 238, 1)',
border: '1px solid #00DCEE',
'border-radius': '43rpx',
}"
></u-button>
</view>
<view v-if="state.order.scaleStatus === 3">
<u-button
text="确认支付"
type="primary"
:customStyle="{ 'border-radius': '43rpx' }"
@click="handleReviewPay"
></u-button>
</view>
<view>
<u-button
text="打印"
type="primary"
:customStyle="{ 'border-radius': '43rpx' }"
></u-button>
</view>
</view>
</view>
<!-- 支付方式 -->
<block v-for="(item, index) in state.sheetList" :key="index">
<u-action-sheet
:actions="contrlModalParams[item.key].list"
:title="contrlModalParams[item.key].title"
:show="contrlModalParams[item.key].isShow"
@select="(v: any) => handleSelect(item.key, v)"
@close="contrlModalParams[item.key].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
<SmallModal
:title="'确认作废吗?'"
:content="'确认作废后,该订单不能恢复!'"
:okText="'确认作废'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import { ReceiveApi } from "@/services/index";
import { onLoad } from "@dcloudio/uni-app";
const keyword = ref("");
const contrlModalParams = reactive<{ [attrName: string]: any }>({
paySelect: {
isShow: false,
title: "请选择支付方式",
// 1:23线4
list: [
{
name: "微信",
key: 3,
},
{
name: "现金",
key: 1,
},
{
name: "支付宝",
key: 4,
},
{
name: "转账",
key: 2,
},
],
},
printSelect: {
isShow: false,
title: "请选择打印设备",
list: [
{
name: "打印设备1",
key: 1,
},
{
name: "打印设备2",
key: 2,
},
{
name: "打印设备3",
key: 3,
},
{
name: "打印设备4",
key: 4,
},
],
},
});
const state = reactive<{
order: Order;
[attrName: string]: any;
}>({
order: {},
sheetList: [
{
key: "paySelect",
},
{
key: "printSelect",
},
],
scaleStatus: 2,
});
const gridList1 = reactive([
{
name: "毛重",
enName: "grossWeight",
num: "",
unit: "KG",
isBefore: false,
},
{
name: "皮重",
enName: "tare",
num: "",
unit: "KG",
isBefore: false,
},
{
name: "扣杂",
enName: "buckleMiscellaneous",
num: "",
unit: "KG",
isBefore: false,
},
{},
{
name: "净重",
enName: "netWeight",
num: "",
unit: "KG",
isBefore: false,
},
{
name: "单价",
enName: "price",
num: "",
unit: "元/KG",
isBefore: false,
},
{
name: "预估总价",
enName: "totalPrice",
num: "",
unit: "元",
isBefore: false,
},
{
name: "货款总价",
enName: "balanceTotalPrice",
num: "",
unit: "元",
isBefore: false,
},
]);
const getIsShow = () => {
return state.order.scaleStatus === 3 || state.order.scaleStatus === 4;
};
const handleScenePhoto = (imagesId: number) => {
uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&id=" + imagesId, //
});
};
// // 3
const handleReviewNoPay = () => {
ReceiveApi.updateOne({ ...state.order, scaleStatus: 3 }).then((res) => {
if (res.code === 200) {
uni.navigateTo({
url: "/pagesReceive/payReview?scaleStatus=3", //
});
}
});
};
//
const handleReviewPay = () => {
contrlModalParams.paySelect.isShow = true;
};
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "paySelect") {
//
ReceiveApi.updateOne({
...state.order,
scaleStatus: 4,
paymentMethod: v.key,
}).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "支付成功",
icon: "success",
});
uni.navigateTo({
url: "/pagesReceive/payReview?scaleStatus=4", //
});
}
});
} else if (key === "printSelect") {
//
}
};
const isShowCancelModal = ref(false);
const deleteId = ref(0);
//
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleOk = () => {
ReceiveApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
if (res.code === 200) {
uni.navigateTo({
url: "/pagesReceive/payReview?scaleStatus=2", //
});
}
});
};
const handleUpdateOrder = () => {
uni.navigateTo({
url: "/pagesReceive/form/pricingForm?id=" + state.order.id, //
});
};
onLoad((option) => {
state.order.id = parseInt((option as any).id);
state.scaleStatus = parseInt((option as any).scaleStatus);
if (state.order.id) {
ReceiveApi.getDetailById({ id: state.order.id }).then((res) => {
if (res.code === 200) {
state.order = res.data;
gridList1.map((item) => {
if (item.name === "扣杂" || item.name === "扣点") {
if (state.order.buttonType === 0) {
item.name = "扣杂";
item.enName = "buckleMiscellaneous";
item.unit = "KG";
} else if (state.order.buttonType === 1) {
item.name = "扣点";
item.enName = "points";
item.unit = "%";
}
}
item.num = state.order[item.enName as string];
});
}
});
}
});
</script>
<style lang="scss" scoped>
.c-card {
margin: 30rpx 25rpx;
.box {
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
padding: 30rpx;
.base {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 400;
font-size: 26rpx;
color: #000000;
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
}
}
.name {
font-weight: 400;
font-size: 26rpx;
color: #000000;
margin: 15rpx 0rpx;
text {
background-color: #ffaf75;
font-weight: 500;
font-size: 26rpx;
color: #ffffff;
padding: 5rpx 20rpx;
margin-left: 20rpx;
}
}
.flex-box1 {
display: flex;
align-items: center;
justify-content: space-between;
margin: 20rpx 0rpx;
.type {
font-weight: 400;
font-size: 26rpx;
color: #ec0f3e;
}
.btn {
display: flex;
> view + view {
margin-left: 10rpx;
}
}
}
.flex-box {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 400;
font-size: 24rpx;
color: #999999;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
padding-bottom: 20rpx;
}
}
.more {
display: grid;
grid-template-columns: repeat(2, 1fr);
flex: 1;
font-weight: 400;
font-size: 26rpx;
color: #000000;
padding: 25rpx 0rpx 0rpx 0rpx;
> view {
line-height: 50rpx;
width: max-content;
}
}
.op-btn {
width: 80%;
margin: 0px auto;
margin-top: 100rpx;
.c-btn-review {
display: flex;
justify-content: space-between;
align-items: center;
background: #f5f5f5;
border-radius: 38rpx;
text-align: center;
margin-bottom: 80rpx;
> view {
width: 50%;
text-align: center;
font-weight: 500;
font-size: 26rpx;
color: #999999;
}
.active {
background: #00dcee;
border-radius: 38rpx;
font-weight: 500;
font-size: 26rpx;
color: #ffffff;
padding: 20rpx 30rpx;
}
}
> view + view {
margin-top: 30rpx;
}
}
}
</style>

View File

@ -0,0 +1,166 @@
<template>
<view class="card-box" v-for="(item, index) in pageList.list" :key="index">
<view class="top-flex-box">
<view>
<view>
<text class="address">{{ item.deviceName || "-" }}</text>
</view>
<view>
<text class="number">收货单号{{ item.receiptNumber }}</text>
</view>
<view>
<text class="name">{{ item.userName }}</text>
</view>
</view>
<view>
<text class="btn" @click="handleScenePhoto((item.imagesId as number))"
>现场照片</text
>
</view>
</view>
<view>
<text class="desc">过毛时间{{ item.grossTime }}</text>
</view>
<view class="flex-box">
<text>毛重{{ item.grossWeight }}KG</text>
<text>单价{{ item.price }} /KG</text>
</view>
<view class="btn-box">
<u-button
text="点击作废"
color="#E8E8E8"
:customStyle="{ color: '#999' }"
@click="handleModal(true, (item.id as number))"
></u-button>
<u-button
type="primary"
text="点击编辑"
@click="pricingDetail((item.id as number))"
></u-button>
</view>
</view>
<SmallModal
:title="'确认作废吗?'"
:content="'确认作废后,该订单不能恢复!'"
:okText="'确认作废'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import { ReceiveApi } from "@/services/index";
import SmallModal from "@/components/Modal/smallModal.vue";
interface PageResult<T> {
total: number;
list: T[];
pageNum: number;
pageSize: number;
}
const pageList: PageResult<Order> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const isShowCancelModal = ref(false);
const deleteId = ref(0);
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleScenePhoto = (imagesId: number) => {
uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&id=" + imagesId, //
});
};
const pricingDetail = (id: number) => {
uni.navigateTo({
url: "/pagesReceive/form/pricingForm?id=" + id, //
});
};
const getOrderList = () => {
ReceiveApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: 1 }).then((res) => {
if (res.code === 200) {
(pageList as any).list = res.data.list;
}
});
};
const handleOk = () => {
console.log(deleteId.value);
ReceiveApi.deleteOrder([deleteId.value]).then((res) => {
if (res.code === 200) {
getOrderList();
}
});
};
onMounted(() => {
getOrderList();
});
</script>
<style lang="scss" scoped>
.card-box {
padding: 38rpx 50rpx;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 0rpx 25rpx;
margin-top: 35rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
.top-flex-box {
display: flex;
justify-content: space-between;
align-items: center;
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
cursor: pointer;
}
}
.address {
margin-right: 30rpx;
}
.desc {
font-size: 24rpx;
color: #999999;
margin-top: 30rpx;
display: inline-block;
}
.name {
font-size: 26rpx;
color: #000000;
font-weight: bold;
}
.flex-box {
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.btn-box {
margin-top: 60rpx;
display: flex;
::v-deep button {
border-radius: 43rpx;
}
::v-deep button + button {
margin-left: 50rpx;
}
}
}
</style>

View File

@ -0,0 +1,92 @@
<template>
<view class="layout">
<view class="name">现场照片</view>
<up-row customStyle="flex-wrap: wrap">
<up-col span="6" v-for="(item, index) in list" :key="index">
<view
class="grid-item"
:style="{
marginLeft: index % 2 === 1 ? '10rpx' : '',
marginRight: index % 2 === 0 ? '10rpx' : '',
marginBottom: '10rpx',
}"
>
<view class="time">{{ item.createTime }}</view>
<text class="tip">{{ getType(item.imagesType) }}过磅</text>
<image :src="item.url" :mode="'widthFix'" />
</view>
</up-col>
</up-row>
</view>
</template>
<script setup lang="ts">
import { onLoad } from "@dcloudio/uni-app";
import { PictureApi } from "@/services/index";
import {ImagesType} from '@/utils/enum'
let list: any = ref([]);
const getType = (v: number) => {
if (v === ImagesType.Tare) {
return "皮重";
} else if (v === ImagesType.GROSSWEIGHT) {
return "毛重";
} else {
return "其他";
}
};
onLoad((option: any) => {
// option.id
PictureApi.getAnnex({
businessId: option.id,
orderType: parseInt(option.orderType),
imagesType: ImagesType.Tare,
}).then((res) => {
if (res.code === 200) {
list.value = res.data;
}
});
});
</script>
<style lang="scss" scoped>
.layout {
margin: 22.44rpx 26.54rpx;
padding: 33rpx 18rpx;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
font-family: Source Han Sans CN;
.name {
font-weight: 400;
font-size: 30rpx;
color: #000000;
margin-bottom: 30rpx;
}
.grid-item {
position: relative;
image {
width: 100% !important;
}
.time {
font-weight: 400;
font-size: 24rpx;
color: rgba(255, 255, 255, 1);
mix-blend-mode: difference;
position: absolute;
bottom: 30rpx;
padding: 0rpx 20rpx;
}
.tip {
background: rgba(0, 0, 0, 0.63);
box-shadow: 0rpx 0rpx 6rpx 0rpx rgba(0, 0, 0, 0.09);
border-radius: 0rpx 40rpx 40rpx 0rpx;
font-weight: 400;
font-size: 24rpx;
color: #ffffff;
padding: 10rpx 20rpx;
position: absolute;
top: 30rpx;
left: 9rpx;
}
}
}
</style>
@/types/status

View File

@ -0,0 +1,318 @@
<template>
<view class="c-card">
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }"
>
<u-form-item
:prop="`order[${item.key}]`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-textarea
v-if="item.type === 'textarea'"
v-model="(model1.order as any)[(item.key as any)]"
:placeholder="`请输入${item.name}`"
></u-textarea>
<u-input
v-if="item.type === 'select' || item.type === 'input'"
v-model="(model1.order as any)[(item.key as any)]"
:placeholder="`${item.type === 'select' ? '选择' : '输入'}${
item.name
}`"
:clearable="true"
:customStyle="{}"
border="none"
>
<template #suffix>
{{ item.unit }}
</template>
</u-input>
<!-- @afterRead="afterRead"
@delete="deletePic" -->
<!-- <u-upload
v-if="item.type === 'upload'"
:fileList="[]"
name="1"
multiple
:maxCount="10"
></u-upload> -->
<uni-file-picker
v-if="item.type === 'upload'"
v-model="model1.order.fileList"
limit="10"
title="最多可上传10张图片"
:auto-upload="false"
fileMediatype="image"
mode="grid"
ref="filesShipmentRef"
></uni-file-picker>
<u-radio-group
v-if="item.type === 'radio'"
v-model="(model1.order as any)[(item.key as any)]"
placement="row"
>
<u-radio activeColor="#00DCEE" label="送货" :name="0"></u-radio>
&nbsp;&nbsp;&nbsp;
<u-radio activeColor="#00DCEE" label="自提" :name="1"></u-radio>
</u-radio-group>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right"></u-icon>
</template>
</u-form-item>
</u-form>
<u-action-sheet
:actions="contrlModalParams.select.selectList"
:title="contrlModalParams.select.title"
:show="contrlModalParams.select.isShow"
@select="contrlModalParams.select.isShow = false"
@close="contrlModalParams.select.isShow = false"
></u-action-sheet>
</view>
<view class="btn-box">
<u-button type="primary" text="保存" @click="save()"></u-button>
</view>
</template>
<script setup lang="ts">
import { PictureApi, ShipmentApi } from "@/services";
import { ImagesType, OrderType, ScaleStatus } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app";
const model1 = reactive<Shipment>({
order: {
id: 0,
splTime: "",
takeType: 1,
fileList: [],
},
});
const rules = ref({
"userInfo.userName": {
type: "string",
required: true,
message: "请输入手机号",
trigger: ["blur", "change"],
},
"userInfo.password": {
type: "string",
required: true,
message: "请输入密码",
trigger: ["blur", "change"],
},
});
const contrlModalParams = reactive({
select: {
isShow: false,
title: "标题",
selectList: [
{
name: "选项一",
},
{
name: "选项二",
},
],
},
});
const formAttrList = reactive([
{
name: "客户",
key: "userId",
type: "select",
required: true,
unit: "",
fn: () => {
contrlModalParams.select.isShow = true;
contrlModalParams.select.title = "客户";
},
},
{
name: "出货产品",
key: "productId",
type: "select",
required: true,
unit: "",
fn: () => {
contrlModalParams.select.isShow = true;
contrlModalParams.select.title = "出货产品";
},
},
{
name: "数量",
key: "number",
type: "input",
required: true,
unit: "件",
},
{
name: "毛重",
key: "grossWeight",
type: "input",
required: true,
unit: "KG",
},
{
name: "提货方式",
key: "deliveryMethod",
required: true,
type: "radio",
},
{
name: "车辆信息",
type: "text",
},
{
name: "车牌号",
key: "carNumber",
type: "input",
unit: "",
},
{
name: "司机电话",
key: "phone",
type: "input",
unit: "",
},
{
name: "集装箱",
type: "text",
},
{
name: "箱号",
key: "box",
type: "input",
unit: "",
},
{
name: "封号",
key: "title",
type: "input",
unit: "",
},
{
name: "备注",
key: "remark",
type: "textarea",
},
{
name: "上传照片",
key: "photo",
type: "upload",
},
]);
const filesShipmentRef = ref();
const handleUpload = () => {
// console.log(event.tempFilePaths)
const list = filesShipmentRef.value[0].filesList;
return list.map((item: any) => {
return new Promise((resolve) => {
PictureApi.upload({
files: item,
path: item.path,
}).then((res) => {
if (res.code === 200) {
resolve({
...(res.data as any),
businessId: model1.order.id,
imagesType: ImagesType.NORMARL, //
orderType: OrderType.Shipment, //
});
}
});
});
});
};
/**
* 点击保存 先执行upload接口
* 上传成功后 保存图片资源 和更新订单数据
*/
const save = () => {
Promise.all(handleUpload()).then((res) => {
//
if (res.length > 0) {
PictureApi.addListAnnex({ annexPos: res }).then((res1) => {
if (res1.code === 200) {
uni.showToast({
title: "图片资源上传成功",
icon: "success",
});
}
});
}
});
//
ShipmentApi.updateOrderIn({
orderOutPos: [
{ ...model1.order, scaleStatus: ScaleStatus.ToBeGrossWeight },
],
}).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "编辑成功",
icon: "success",
});
uni.navigateTo({
url: "/pagesShipment/grossWeight", //
});
}
});
};
onLoad((option) => {
model1.order.id = (option as any).id;
if (model1.order.id) {
ShipmentApi.getDetailById({ id: model1.order.id }).then((res) => {
if (res.code === 200) {
model1.order = res.data;
}
});
PictureApi.getAnnex({
businessId: model1.order.id,
orderType: 1,
imagesType: ImagesType.NORMARL,
}).then((res) => {
if (res.code === 200) {
}
});
}
});
</script>
<style lang="scss" scoped>
.c-card {
background: #ffffff;
// box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 30rpx 25rpx;
padding: 10rpx 20rpx;
::v-deep .u-form-item {
height: auto;
}
::v-deep .u-form-item + .u-form-item {
border-top: 1rpx solid rgba(233, 233, 233, 0.76);
}
}
.btn-box {
margin-top: 60rpx;
display: flex;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12);
border-radius: 13rpx 13rpx 0rpx 0rpx;
padding: 25rpx 50rpx;
position: sticky;
bottom: 0rpx;
z-index: 999;
::v-deep button {
border-radius: 43rpx;
}
}
</style>

View File

@ -0,0 +1,166 @@
<template>
<view class="card-box" v-for="(item, index) in pageList.list" :key="index">
<view class="top-flex-box">
<view>
<view>
{{ item.id }}
<text class="address">{{ item.deviceName || "-" }}</text>
</view>
<view>
<text class="number">出货单号{{ item.orderNumber }}</text>
</view>
<view>
<text class="name">{{ item.cardId }}</text>
</view>
</view>
<view>
<text class="btn" @click="handleScenePhoto((item.imagesId as number))"
>现场照片</text
>
</view>
</view>
<view>
<text class="desc">过磅时间{{ item.tareTime }}</text>
</view>
<view class="flex-box">
<text>皮重{{ item.tare }}kg</text>
</view>
<view class="btn-box">
<u-button
text="点击作废"
color="#E8E8E8"
:customStyle="{ color: '#999' }"
@click="handleModal(true, (item.id as any))"
></u-button>
<u-button
type="primary"
text="点击编辑"
@click="pricingDetail((item.id as any))"
></u-button>
</view>
</view>
<SmallModal
:title="'确认作废吗?'"
:content="'确认作废后,该订单不能恢复!'"
:okText="'确认作废'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import { ShipmentApi } from "@/services/index";
import SmallModal from "@/components/Modal/smallModal.vue";
interface PageResult<T> {
total: number;
list: T[];
pageNum: number;
pageSize: number;
}
const pageList: PageResult<Shipment> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const isShowCancelModal = ref(false);
const deleteId = ref(0);
const handleModal = (v: boolean, id: number) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleScenePhoto = (imagesId: number) => {
uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=2&id=" + imagesId, //
});
};
const pricingDetail = (id: string) => {
uni.navigateTo({
url: "/pagesShipment/form/shipmentForm?id=" + id, //
});
};
const getOrderList = () => {
ShipmentApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: 0 }).then((res) => {
if (res.code === 200) {
(pageList as any).list = res.data.list;
}
});
};
const handleOk = () => {
console.log(deleteId.value);
ShipmentApi.deleteOrder({ids:[deleteId.value]}).then((res) => {
if (res.code === 200) {
getOrderList();
}
});
};
onMounted(() => {
getOrderList();
});
</script>
<style lang="scss" scoped>
.card-box {
padding: 38rpx 50rpx;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 0rpx 25rpx;
margin-top: 35rpx;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
.top-flex-box {
display: flex;
justify-content: space-between;
align-items: center;
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
cursor: pointer;
}
}
.address {
margin-right: 30rpx;
}
.desc {
font-size: 24rpx;
color: #999999;
margin-top: 30rpx;
display: inline-block;
}
.name {
font-size: 26rpx;
color: #000000;
font-weight: bold;
}
.flex-box {
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.btn-box {
margin-top: 60rpx;
display: flex;
::v-deep button {
border-radius: 43rpx;
}
::v-deep button + button {
margin-left: 50rpx;
}
}
}
</style>

48
src/services/demo copy.ts Normal file
View File

@ -0,0 +1,48 @@
// 存放路径: src/services/home.ts
import { http } from '@/utils/http'
/**
* -广-
* @param distributionSite 广 12 1
*/
export const getHomeBannerAPI = (distributionSite = 1) => {
return http({
method: 'GET',
url: '/home/banner',
data: {
distributionSite,
},
})
}
// services/home.ts
/**
* --
*/
export const getHomeCategoryAPI = () => {
return http({
method: 'GET',
url: '/home/category/mutli',
})
}
// services/home.ts
/**
* --
*/
export const getHomeHotAPI = () => {
return http({
method: 'GET',
url: '/home/hot/mutli',
})
}
// src/services/home.ts
/**
* -
*/
export const getHomeGoodsGuessLikeAPI = (data: any) => {
return http({
method: 'GET',
url: '/home/goods/guessLike',
data,
})
}

View File

@ -1,3 +1,5 @@
export * as ProfileApi from './profile' export * as ProfileApi from './profile'
export * as ReceiveApi from './receive' export * as ReceiveApi from './receive'
export * as ShipmentApi from './shipment' export * as ShipmentApi from './shipment'
export * as PictureApi from './picture'
export * as ReceiveProductApi from './receiveProduct'

51
src/services/picture.ts Normal file
View File

@ -0,0 +1,51 @@
import type { ImagesType } from "@/utils/enum";
import { http } from "@/utils/http";
// 资源存储接口
export const addAnnex = (data: any) => {
return http({
method: "POST",
url: "/api/annex/addAnnex",
data,
});
};
// 获取图片资源
export const getAnnex = (data: {businessId: number, orderType: number, imagesType: ImagesType | any}) => {
return http<Resource>({
method: "GET",
url: "/api/annex/getAnnex",
data
});
};
// 批量存储资源
export const addListAnnex = (data: any) => {
return http({
method: "POST",
url: "/api/annex/addListAnnex",
data,
});
};
// 多个上传
export const uploadList = (data: any) => {
return http({
method: "POST",
header: {type: 'UPLOAD'},
url: "/api/file/uploadList",
data,
});
};
// 单个上传
export const upload = (data: any) => {
return http({
method: "POST",
header: {type: 'UPLOAD'},
url: "/api/file/upload",
data,
});
};

View File

@ -94,3 +94,16 @@ export const addMenusRole = (data: {
data, data,
}); });
}; };
// 查询用户列表
export const getUserList = (data: {
name?: string;
userType?: number; // 1= 工作人员 2=采购商
}) => {
return http({
method: "GET",
url: "/api/user/getUserList",
data,
});
};

View File

@ -3,55 +3,9 @@ import type { Result } from '@/types/global'
import { http } from "@/utils/http"; import { http } from "@/utils/http";
type PageParams = {
pageNumber: number,
pageSize: number,
pricingUserId?: string, // 定价人
userId?: string, // 供应商id
productId?: string, // 产品id
repairFlag?: boolean, // 是否为补单,true 是未补单false是补单
scaleStatus?: number, // 磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
}
interface ReceiveOrderPage<T> {
total: number,
list: T,
pageNum: number,
pageSize: number
}
type ReceiveOrder = {
id: number,
deviceId: number, // 设备id
deviceName: string, // 设备名称
userId: number, // 用户id
cardId: number, //库存卡id
cardNumber: number, // 库存卡号
userName: string, // 用户名称:关联用户表得到
productId: number, // 品类id
productName: string, // 品类名称:关联品类表得到
imagesId: string,
imageUrls: string,
carNumber: string, // 车牌号
receiptNumber: string, // 收货单号
grossWeight: number, // 毛重
tare: number, // 皮重
grossTime: string, // 过毛日期
tareTime: string, // 过皮日期
netWeight: string, // 净重(净重=净重*1-扣点)-扣杂)
buttonType: string, // 扣杂状态0扣杂1扣点
points: string, // 扣点
buckleMiscellaneous: string, //扣杂
price: string, // 单价
balanceTotalPrice: string, //结算总价
totalPrice: string, //实际总价
weighingMethod: string, //称重方式0有皮重 1零皮重
multiCategory: string, // 多品类0单品类 1多品类
}
// 收库单分页查询 // 收库单分页查询
export const getOrderPage = (data: PageParams) => { export const getOrderPage = (data: PageParams) => {
return http<ReceiveOrderPage<ReceiveOrder>>({ return http<OrderPage<Order>>({
method: "GET", method: "GET",
url: "/api/orderIn/getOrderPage", url: "/api/orderIn/getOrderPage",
data, data,
@ -68,7 +22,7 @@ export const getList = () => {
//根据id获取收货单详情 //根据id获取收货单详情
export const getDetailById = (data: {id: number}) => { export const getDetailById = (data: {id: number}) => {
return http<Result>({ return http<Order>({
method: "GET", method: "GET",
url: "/api/orderIn/getOne", url: "/api/orderIn/getOne",
data data
@ -110,14 +64,7 @@ export const deleteOrder = (data: any) => {
}; };
// 统计首页的本月总收获以及总支出 // 统计首页的本月总收获以及总支出
// 收货类型 // 收货类型
type ReceiveSummary = {
totalReceipt: number, // 本月总出货
totalExpenditure: number, // 本月总收入
toBePriced: number, // 待收货
toBeTare: number, // 待过皮重
audit: number, // 付款审核
toBePaid: number, // 待支付
}
export const countOrderByMonth = () => { export const countOrderByMonth = () => {
return http<ReceiveSummary>({ return http<ReceiveSummary>({
method: "GET", method: "GET",
@ -125,4 +72,15 @@ export const countOrderByMonth = () => {
}); });
}; };
// 更新定价详情
export const updateOne = (data: any) => {
return http<Result>({
method: "POST",
url: "/api/orderIn/updateOne",
data,
});
};

View File

@ -0,0 +1,20 @@
import { http } from "@/utils/http";
// 收货产品分页列表
export const getReceiveProduct = () => {
return http({
method: "GET",
url: "/api/reproducts/getPage"
});
};
// 查询收货产品列表All
export const getAllReProducts = () => {
return http({
method: "GET",
url: "/api/reproducts/allReProducts"
});
};

View File

@ -9,6 +9,42 @@ type ShipmentSummary = {
shipmentReview: number, // 出货结算 shipmentReview: number, // 出货结算
toBeSettled: number, // 待结算 toBeSettled: number, // 待结算
} }
// 根据id查询出货单
export const getDetailById = (data: {id: number}) => {
return http<Shipment>({
method: "GET",
url: "/api/orderOut/getOne",
data
});
};
// 根据条件查询出库单下拉列表
export const getList = () => {
return http<Shipment>({
method: "GET",
url: "/api/orderOut/getList"
});
};
type PageParams = {
userId?: number; // 供应商id
productId?: string; // 产品id
cardId?: number;
deviceId?:number;
scaleStatus?: number; // 磅单状态0待出货1:待过毛2待审核3已审未付4已审已付
flag?: boolean; // true 皮重 false 毛重
pageNumber: number;
pageSize: number;
startTime?: string; // 开始时间
endTime?: string; // 结束时间
};
// 根据条件获取出库单,并且进行分页
export const getOrderPage = (data: PageParams) => {
return http<OrderPage<Shipment>>({
method: "GET",
url: "/api/orderOut/getOrderPage",
data
});
};
// 统计首页的本月收入以及待出库 // 统计首页的本月收入以及待出库
export const countOrderByMonth = () => { export const countOrderByMonth = () => {
return http<ShipmentSummary>({ return http<ShipmentSummary>({
@ -16,3 +52,46 @@ export const countOrderByMonth = () => {
url: "/api/orderOut/countOrderByMonth" url: "/api/orderOut/countOrderByMonth"
}); });
}; };
// 出库分类统计
export const getOrderInReceipt = () => {
return http<Shipment>({
method: "GET",
url: "/api/orderOut/OrderInReceipt"
});
};
// 出货单排行榜
export const getOrderInRanking = () => {
return http<Shipment>({
method: "GET",
url: "/api/orderOut/OrderInRanking"
});
};
// 单个或则批量作废
export const deleteOrder = (data: any) => {
return http<Shipment>({
method: "POST",
url: "/api/orderOut/delete",
data,
});
};
// 新增出货单
export const addOrderOut = (data: any) => {
return http<Shipment>({
method: "POST",
url: "/api/orderOut/addOrderOut",
data,
});
};
// 批量修改出货单
export const updateOrderIn = (data: any) => {
return http<Shipment>({
method: "POST",
url: "/api/orderOut/updateOrderIn",
data,
});
};

View File

@ -7,9 +7,11 @@ export const useMemberStore = defineStore(
() => { () => {
// 会员信息 // 会员信息
const profile = ref({ const profile = ref({
token: '',
userInfo: { userInfo: {
userName: "", userName: "",
factory_name: "", factory_name: "",
}, },
}); });

View File

@ -1,4 +1,6 @@
declare var wx: any; declare var wx: any;
declare var $_: any;
export type PageResult<T> = { export type PageResult<T> = {
items: T[], items: T[],
counts: number, counts: number,
@ -18,3 +20,5 @@ export type Result = {
message: string, message: string,
time: string time: string
} }
export type ComType = {[attrName: string]: any }

112
src/types/order.d.ts vendored Normal file
View File

@ -0,0 +1,112 @@
interface Order {
id?: number;
deviceId?: number; //设备id
deviceName?: string; // 设备名称
userId?: number | string; //供应商id
cardId?: number; //库存卡id
cardNumber?: string; //undefined
userName?: string; //undefined
productId?: number | string; //产品id
productName?: string; //undefined
imagesId?: number | undefined; //弃用
imageUrls?: string; //弃用
carNumber?: string; //车牌号
receiptNumber?: string; //收货单号
grossWeight?: number; //毛重
tare?: string; //皮重
grossTime?: string; //过毛日期
tareTime?: string; //过皮日期
netWeight?: string; //净重
buttonType?: number; //扣杂状态0扣杂1扣点
points?: number; //扣点
buckleMiscellaneous?: number; //扣杂
price?: string; //单价
balanceTotalPrice?: string; //结算总价 货款金额
totalPrice?: string; //实际总价 预估价格
weighingMethod?: number; //称重方式0有皮重 1零皮重
multiCategory?: number; //多品类0单品类 1多品类
notes?: string; //备注
scaleStatus?: number; // 磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
paymentMethod?: string; //支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝
updateTime?: string; //修改时间
repairTime?: string; //补单时间
createTime?: string; //创建时间
updateUserId?: number; //修改人
createUserId?: number; //创建人
reviewerUserId?: string; //审核人
reviewerUserName?: string; // 审核人名称
pricingUserId?: string; //定价人
pricingUserName?: string; //定价人名称
fileList?: array;
subtractNum?: number; // input 扣杂扣点参数
isChecked?: boolean;
[attrName: string]: any;
}
interface Shipment {
id?: string;
userId?: number; //供应商id
productId?: number; //产品id
cardId?: number; //库存卡id
imagesId?: number; //图片表id
deviceId?: number; //设备id
carNumber?: string; //车牌号
scaleStatus?: number; //出库单状态
orderNumber?: string; //订单编号
grossWeight?: number; //毛重
grossTime?: string; //过毛时间
tare?: number; //皮重
tareTime?: string; //过皮时间
netWeight?: string; //净重
number?: number; //数量
notes?: string; //备注
settlementNotes?: string; //结算备注
deliveryMethod?: string; //提货方式:0:送货1:自提
phone?: string; //手机号
box?: string; //箱号
title?: string; //封号
freight?: string; //运费
incidentals?: string; //杂费
pricingPerson?: string; //定价人
reviewerId?: string; //审核人
buttonType?: string; //扣点状态默认0扣杂1扣点
points?: string; //扣点
buckleMiscellaneous?: string; //扣杂
unitPrice?: string; //结算单价
estimatePrice?: string; //预估金额
totalPrice?: string; //结算金额
realIncome?: string; //实际收入
errorPrice?: string; //误差金额
repairTime?: string; //补单时间
createTime?: string; //undefined
createUserId?: string; //undefined
updateUserId?: string; //undefined
updateTime?: string; //undefined
isDeleted?: string; //删除标识true删除false未删除
[attrName: string]: any;
}
// 分页结构
interface OrderPage<T> {
total: number;
list: T;
pageNum: number;
pageSize: number;
}
interface ReceiveSummary {
totalReceipt: number; // 本月总出货
totalExpenditure: number; // 本月总收入
toBePriced: number; // 待收货
toBeTare: number; // 待过皮重
audit: number; // 付款审核
toBePaid: number; // 待支付
}
type PageParams = {
pageNumber: number;
pageSize: number;
pricingUserId?: string; // 定价人
userId?: string; // 供应商id
productId?: string; // 产品id
repairFlag?: boolean; // 是否为补单,true 是未补单false是补单
scaleStatus?: number; // 磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
};

8
src/types/resouce.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
interface Resource {
businessId: number,
orderType: number, // 1入库单 2出库单
imagesType: number, // 0:普通资源1皮重 2毛重
url: string,
urlName: string,
urlSuffix: string, // 附件后缀
}

2
src/types/user.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
interface User {
}

55
src/utils/enum.ts Normal file
View File

@ -0,0 +1,55 @@
// 1收货2出货
export enum OrderType {
Receive = 1,
Shipment = 2,
}
// 扣杂状态0扣杂1扣点
export enum ButtonType {
BuckleMiscellaneous = 0,
Points = 1,
}
// 称重方式0有皮重 1零皮重
export enum WeighingMethod {
Yes = 0,
No = 1,
}
// 多品类0单品类 1多品类
export enum MultiCategory {
Single = 0,
Multiple = 1,
}
// 0:普通资源1皮重 2毛重
export enum ImagesType {
NORMARL = 0,
Tare = 1,
GROSSWEIGHT = 2,
}
//磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
// 磅单状态0待出货1:待过毛2待审核3已审未付4已审已付
export enum ScaleStatus {
ToBePriced = 0,
ToBeTare = 1,
ToBeReview = 2,
ToBePay = 2,
Paid = 4,
ToBeShipment = 0,
ToBeGrossWeight = 1,
ToBeShipmentReview = 2,
ToBeShipmentPay = 3,
ShipmentPaid = 4
}
// 支付方式0:未支付,1:现金支付2银行卡支付3线上支付微信4支付宝
export enum PaymentMethod {
NoPay = 0,
Cash = 1,
BankCard = 2,
WeChat = 2,
Alipay = 4
}
//用户类型0刷脸1刷卡
export enum UserType {
Face = 0,
Card = 1,
}

View File

@ -1,17 +1,15 @@
import { useMemberStore } from "@/store/modules/member"; import { useMemberStore } from "@/store/modules/member";
import ENV_CONFIG from "../config/env"; import ENV_CONFIG from "../config/env";
// 基础地址 // 基础地址
let baseUrl = ""; let baseUrl = "";
// #ifdef H5 // #ifdef H5
(process.env as any).config= ENV_CONFIG (process.env as any).config = ENV_CONFIG;
// #endif // #endif
baseUrl = (process.env as any).config[(process.env as any).NODE_ENV] baseUrl = (process.env as any).config[(process.env as any).NODE_ENV]
.VITE_APP_BASE_URL; .VITE_APP_BASE_URL;
const store = useMemberStore(); const store = useMemberStore();
const obj = { const obj = {
@ -54,31 +52,74 @@ interface Data<T> {
*/ */
export const http = <T>(options: UniApp.RequestOptions) => { export const http = <T>(options: UniApp.RequestOptions) => {
return new Promise<Data<T>>((resolve, reject) => { return new Promise<Data<T>>((resolve, reject) => {
console.log(options);
if ((options as any).header?.type === "UPLOAD") {
uni.uploadFile({
header: {
"x-userToken": store.profile?.token,
// #ifdef H5
"Content-Type": "multipart/form-data",
// #endif
},
url: baseUrl + options.url, //仅为示例,非真实的接口地址
fileType: "image",
// #ifdef H5
files: (options as any).data.files,
// #endif
// #ifdef MP-WEIXIN
filePath: (options as any).data.path,
// #endif
name: "file",
formData: {
file: (options as any).data.files,
}, // HTTP 请求中其他额外的 form data
success: (res) => {
resolve(JSON.parse(res.data) as Data<T>);
},
fail(err) {
console.log(err);
},
});
} else {
uni.request({ uni.request({
...options, ...options,
dataType:'string', //1.先将dataType设置为string
success(res) { success(res) {
var json=(res.data as any).replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2')
//2.根据后端返回的数据调用一次或者两次replace替换
var json1=json.replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2')
//3.手动转换回json数据即可
let res1 = JSON.parse(json1);
console.log(res1)
if (res.statusCode >= 200 && res.statusCode < 300) { if (res.statusCode >= 200 && res.statusCode < 300) {
if ( if (
(res.data as any).code === 1001 || (res1 as any).code === 1001 ||
(res.data as any).code === 1002 (res1 as any).code === 1002
) { ) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: (res.data as Data<T>).message || "请求失败", title: (res1 as Data<T>).message || "请求失败",
}); });
store.clearProfile(); store.clearProfile();
// uni.navigateTo({ uni.navigateTo({
// url: "/pages/login/index", url: "/pages/login/index",
// }); });
return; return;
} }
resolve(res.data as Data<T>); if ((res1 as any).code === 10001) {
uni.showToast({
icon: "none",
title: (res1 as Data<T>).message || "请求失败",
});
return
}
resolve(res1 as Data<T>);
} else { } else {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: (res.data as Data<T>).msg || "请求失败", title: (res1 as any).msg || "请求失败",
}); });
reject(res); reject(res1);
} }
}, },
fail(err) { fail(err) {
@ -89,5 +130,6 @@ export const http = <T>(options: UniApp.RequestOptions) => {
reject(err); reject(err);
}, },
}); });
}
}); });
}; };