Compare commits

...

11 Commits

Author SHA1 Message Date
admin 447d9ab591 update: 新增收货产品价格比较 2024-06-07 10:49:08 +08:00
admin a2eaa00117 update: 1.支付明细 收入明细 系统数据不可删除 2.出货批量审核优化 2024-06-07 09:35:36 +08:00
admin ebd6e37efa update:
1. 账单详情  出货结算 付款审核 客户列表 库存卡对应的分页
2. 定价单:预估总价显示问题 当为待审核是不用判断是否为补单数据
3. 上传对应的接口url更新
2024-06-06 16:47:00 +08:00
admin 6725ac0f3f update: 付款审核tab切换 全选重置 2024-06-05 15:58:21 +08:00
admin a896baaa35 update: ordertype 类型优化 2024-06-05 13:44:33 +08:00
admin e99c77e58e update: 网络请求更新 2024-06-04 10:35:28 +08:00
admin 87bd3b0544 update: 细节优化 2024-06-04 09:50:18 +08:00
admin 4b4c39ae5a update: 结算部分优化 2024-05-31 14:30:23 +08:00
admin b4f15aeb8b update: 兼容性优化 2024-05-30 15:15:03 +08:00
admin 509476fbce update: 细节优化 2024-05-30 10:07:35 +08:00
admin e86e17b7c9 update: 细节优化 2024-05-23 13:37:29 +08:00
36 changed files with 498 additions and 206 deletions

View File

@ -1,19 +1,21 @@
<script setup lang="ts"> <script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"; import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
const isFirstLaunch = ref(true); // const isFirstLaunch = ref(true);
onLaunch(() => { onLaunch(() => {
console.log("App Launch"); // console.log(Boolean(uni.getStorageSync("hasLaunched")))
// // //
if (Boolean(uni.getStorageSync("hasLaunched"))) { // if (Boolean(uni.getStorageSync("hasLaunched"))) {
// // //
isFirstLaunch.value = false; // isFirstLaunch.value = false;
console.log("不再显示启动页"); // console.log("");
} else { // } else {
//
uni.setStorageSync("hasLaunched", true); // //
uni.redirectTo({ url: "pagesLaunch/index" }); // uni.redirectTo({ url: "pagesLaunch/index" });
} // uni.setStorageSync("hasLaunched", true);
// console.log('******* ')
// }
}); });
onShow(() => { onShow(() => {
console.log("App Show"); console.log("App Show");

View File

@ -26,7 +26,9 @@
<view <view
>{{ state.type === "1" ? "应付" : "应收" }}金额<text class="num" >{{ state.type === "1" ? "应付" : "应收" }}金额<text class="num"
>¥{{ >¥{{
state.type === "1" ? formatMoney(item.balanceTotalPrice) : formatMoney(item.totalPrice) state.type === "1"
? formatMoney(item.balanceTotalPrice)
: formatMoney(item.totalPrice)
}}</text }}</text
></view ></view
> >
@ -85,22 +87,25 @@ const getList = (v?: boolean) => {
ReceiveApi.getOrderPage(params).then((res) => { ReceiveApi.getOrderPage(params).then((res) => {
if (res.code === 200) { if (res.code === 200) {
pageList.isLoading = false; pageList.isLoading = false;
(pageList as any).list = (res.data.list as any).map((item: any) => { pageList.list = pageList.list.concat(
res.data.list.map((item: any) => {
return { ...item, isChecked: false }; return { ...item, isChecked: false };
}); })
);
pageList.total = (res.data as any).total; pageList.total = (res.data as any).total;
} }
}); });
} else if (state.type === "2") { } else if (state.type === "2") {
ShipmentApi.getOrderPage(params).then((res) => { ShipmentApi.getOrderPage(params).then((res) => {
if (res.code === 200) { if (res.code === 200) {
pageList.isLoading = false; pageList.isLoading = false;
(pageList as any).list = (res.data.list as any).map((item: any) => {
return { ...item, isChecked: false };
});
pageList.total = (res.data as any).total;
pageList.list = pageList.list.concat(
res.data.list.map((item: any) => {
return { ...item, isChecked: false };
})
);
pageList.total = (res.data as any).total;
} }
}); });
} }

View File

@ -79,13 +79,10 @@ const handleSelect = (item: any) => {
}; };
const getList = () => { const getList = () => {
if (props.isShipment) { if (props.isShipment) {
GoodsApi.getChildrenList().then((res) => { GoodsApi.getChildrenList().then((res) => {
if (res.code === 200) {
if (res.code === 200) { if (res.code === 200) {
state.list = res.data; state.list = res.data;
} }
}
}); });
} else { } else {
ReceiveProductApi.getAllReProducts().then((res) => { ReceiveProductApi.getAllReProducts().then((res) => {

View File

@ -49,7 +49,6 @@ const props = defineProps<{
}>(); }>();
const emit = defineEmits(["handleDialog", "changeProduct"]); const emit = defineEmits(["handleDialog", "changeProduct"]);
const handleClose = () => { const handleClose = () => {
debugger
emit("handleDialog", false); emit("handleDialog", false);
}; };

View File

@ -157,7 +157,7 @@ const gridList2 = reactive([
]); ]);
const handleScenePhoto = (id: string) => { const handleScenePhoto = (id: string) => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, // url: "/pagesScenePhoto/index?orderType=2&imagesType=1&id=" + id, //
}); });
}; };
const state = reactive<any>({ const state = reactive<any>({

View File

@ -19,8 +19,8 @@ const props = withDefaults(
} }
); );
const navbarRect = reactive({ const navbarRect = reactive({
height: 32, height: 42,
top: 28, top: 48,
safeHeight: 500, safeHeight: 500,
}); });
const getSafeHeight = () => { const getSafeHeight = () => {

View File

@ -67,8 +67,8 @@ const props = withDefaults(
); );
const navbarRect = reactive({ const navbarRect = reactive({
height: 32, height: 42,
top: 28, top: 48,
msgCount: 10, msgCount: 10,
}); });
onMounted(() => { onMounted(() => {

View File

@ -15,8 +15,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const navbarRect = reactive({ const navbarRect = reactive({
height: 32, height: 42,
top: 28, top: 48,
msgCount: 10, msgCount: 10,
}); });

View File

@ -3,7 +3,7 @@ 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: 'https://47.100.31.83:8081', // VITE_APP_BASE_URL: 'https://47.100.31.83:8081',
// appid: '', // appid: '',
VITE_APP_BASE_URL: 'https://ifanda.52zaisheng.cn/prod', VITE_APP_BASE_URL: 'https://cloud.52zaisheng.cn',
appid: 'wx9251d74fe0e87028', appid: 'wx9251d74fe0e87028',
} }
@ -13,7 +13,7 @@ const test = {
} }
const production = { const production = {
VITE_APP_BASE_URL: 'https://ifanda.52zaisheng.cn/prod', VITE_APP_BASE_URL: 'https://cloud.52zaisheng.cn',
appid: 'wx9251d74fe0e87028', appid: 'wx9251d74fe0e87028',
} }

View File

@ -4,11 +4,13 @@
"appid" : "__UNI__898003A", "appid" : "__UNI__898003A",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : 100,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
"ignoreVersion": false, "compatible" : {
"ignoreVersion" : true
},
"usingComponents" : true, "usingComponents" : true,
"nvueStyleCompiler" : "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3, "compilerVersion" : 3,

View File

@ -83,8 +83,10 @@ const handleInput = (e: any, item: any) => {
icon: "none", icon: "none",
}); });
} }
const minPrice = parseFloat(model1.formData.minPrice)
const maxPrice = parseFloat(model1.formData.maxPrice)
if (item.key === "maxPrice") { if (item.key === "maxPrice") {
if (model1.formData.minPrice > model1.formData.maxPrice) { if (minPrice > maxPrice) {
uni.showToast({ uni.showToast({
title: `${item.name}应小于${model1.formData.maxPrice}`, title: `${item.name}应小于${model1.formData.maxPrice}`,
icon: "none", icon: "none",
@ -93,10 +95,10 @@ const handleInput = (e: any, item: any) => {
} }
} }
if (item.key === "commonPrice") { if (item.key === "commonPrice") {
if (model1.formData.minPrice > -1 && model1.formData.maxPrice > -1) { if (minPrice > -1 && maxPrice > -1) {
if ( if (
temp < model1.formData.minPrice || !(temp >= minPrice &&
temp > model1.formData.maxPrice temp <= maxPrice)
) { ) {
uni.showToast({ uni.showToast({
title: `${item.name}应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`, title: `${item.name}应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`,
@ -253,16 +255,20 @@ const check = () => {
}; };
const save = () => { const save = () => {
if (model1.formData.minPrice > model1.formData.maxPrice) { const minPrice = parseFloat(model1.formData.minPrice)
const maxPrice = parseFloat(model1.formData.maxPrice)
if (minPrice > maxPrice) {
uni.showToast({ uni.showToast({
title: `最低价应小于${model1.formData.maxPrice}`, title: `最低价应小于${model1.formData.maxPrice}`,
icon: "none", icon: "none",
}); });
return; return;
} }
if (model1.formData.minPrice > -1 && model1.formData.maxPrice > -1) {
if (minPrice > -1 &&maxPrice > -1) {
const temp = model1.formData.commonPrice; const temp = model1.formData.commonPrice;
if (temp < model1.formData.minPrice || temp > model1.formData.maxPrice) { if (!(temp >= minPrice && temp <= maxPrice)) {
uni.showToast({ uni.showToast({
title: `常用价格应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`, title: `常用价格应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`,
icon: "none", icon: "none",
@ -270,7 +276,6 @@ const save = () => {
return; return;
} }
} }
console.log(model1.formData);
check().then((res) => { check().then((res) => {
if (res) { if (res) {
startSave(); startSave();

View File

@ -65,7 +65,7 @@ const handleModal = (v: boolean, id: number) => {
deleteId.value = id; deleteId.value = id;
}; };
const handleOk = () => { const handleOk = () => {
deleteCustomer({id: deleteId.value}) deleteCustomer({ id: deleteId.value });
}; };
const state = reactive<any>({ const state = reactive<any>({
name: "", name: "",
@ -125,16 +125,16 @@ const getList = (v?: boolean) => {
params.supplierTypeId = state.supplierTypeId; params.supplierTypeId = state.supplierTypeId;
} }
pageList.isLoading = true; pageList.isLoading = true;
CustomerApi.getCustomUserPage(params).then((res) => { CustomerApi.getCustomUserPage(params).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
pageList.isLoading = false; pageList.isLoading = false;
(pageList as any).list = (res.data as any).list; pageList.list = pageList.list = pageList.list.concat(res.data.list);
pageList.total = (res.data as any).total; pageList.total = res.data.total;
} }
}); });
}; };
onShow(() => { onShow(() => {
resetPageList() resetPageList();
getList(); getList();
}); });
</script> </script>

View File

@ -50,6 +50,7 @@
<u-swipe-action-item <u-swipe-action-item
:options="options1" :options="options1"
v-for="(item, index) in pageList.list" v-for="(item, index) in pageList.list"
:disabled="[1].indexOf(item.paymentType) === -1"
:key="index" :key="index"
@click="handleItem(item)" @click="handleItem(item)"
> >

View File

@ -45,6 +45,7 @@
<u-swipe-action-item <u-swipe-action-item
:options="options1" :options="options1"
v-for="(item, index) in pageList.list" v-for="(item, index) in pageList.list"
:disabled="[2,3].indexOf(item.paymentType) === -1"
:key="index" :key="index"
@click="handleItem(item)" @click="handleItem(item)"
> >

View File

@ -40,7 +40,8 @@
<view class="type">{{ item.productName }}</view> <view class="type">{{ item.productName }}</view>
<view class="flex-box"> <view class="flex-box">
<text>定价人{{ item.pricingUserName }}</text> <text>定价人{{ item.pricingUserName }}</text>
<text>过磅时间{{ item.tareTime }}</text> <!-- 过毛时间 -->
<text>过磅时间{{ item.grossTime }}</text>
</view> </view>
<view class="more"> <view class="more">

View File

@ -496,7 +496,6 @@ const handleUpload = () => {
const handleSelect = (key: string, v: any) => { const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false; contrlModalParams[key].isShow = false;
if (key === "user") { if (key === "user") {
debugger;
model1.order.userName = v.name; model1.order.userName = v.name;
model1.order.userId = v.id; model1.order.userId = v.id;
} else if (key === "product") { } else if (key === "product") {

View File

@ -25,16 +25,20 @@
:isLoading="pageList.isLoading" :isLoading="pageList.isLoading"
> >
<view class="box"> <view class="box">
<view v-for="(item, index) in pageList.list" :key="index"> <block v-for="(item, index) in pageList.list" :key="index">
<view v-if="item.roleName !== '超级管理员'">
<view> <view>
<view>{{ item.roleName }}</view> <view>{{ item.roleName }}</view>
</view> </view>
<view class="op-box"> <view class="op-box">
<view class="btn" @click="edit(item)"> 编辑 </view> <view class="btn" @click="edit(item)"> 编辑 </view>
<view class="btn" @click="handleModal(true, item.id)"> 删除 </view> <view class="btn" @click="handleModal(true, item.id)">
删除
</view> </view>
</view> </view>
</view> </view>
</block>
</view>
</page-view> </page-view>
</view> </view>
@ -60,7 +64,7 @@ const handleModal = (v: boolean, id: number) => {
deleteId.value = id; deleteId.value = id;
}; };
const handleOk = () => { const handleOk = () => {
deleteRole({id: deleteId.value}) deleteRole({ id: deleteId.value });
}; };
const state = reactive<any>({ const state = reactive<any>({
@ -68,7 +72,7 @@ const state = reactive<any>({
}); });
const pageList: PageResult<{ const pageList: PageResult<{
roleName: string; roleName: string;
id: number id: number;
}> = reactive({ }> = reactive({
noMoreData: false, noMoreData: false,
total: 0, total: 0,
@ -98,13 +102,13 @@ const edit = (item: any) => {
const deleteRole = (item: any) => { const deleteRole = (item: any) => {
ProfileApi.updateRole({ isDeleted: true, id: item.id }).then((res) => { ProfileApi.updateRole({ isDeleted: true, id: item.id }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
resetPageList() resetPageList();
getList(); getList();
} }
}); });
}; };
const handleSearch = () => { const handleSearch = () => {
resetPageList() resetPageList();
getList(); getList();
}; };
const getList = (v?: boolean) => { const getList = (v?: boolean) => {
@ -121,17 +125,15 @@ const getList = (v?: boolean) => {
}; };
pageList.isLoading = true; pageList.isLoading = true;
ProfileApi.getRoleList(params).then((res) => { ProfileApi.getRoleList(params).then((res) => {
if (res.code === 200) {
if (res.code === 200) { if (res.code === 200) {
pageList.isLoading = false; pageList.isLoading = false;
(pageList as any).list = res.data as any; (pageList as any).list = res.data as any;
} }
}
}); });
}; };
onShow(() => { onShow(() => {
resetPageList() resetPageList();
getList(); getList();
}); });
</script> </script>

View File

@ -171,7 +171,7 @@ const gridList1 = reactive([
]); ]);
const handleScenePhoto = (id: string) => { const handleScenePhoto = (id: string) => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, // url: "/pagesScenePhoto/index?orderType=2&imagesType=1&id=" + id, //
}); });
}; };

View File

@ -347,7 +347,7 @@ const gridList1 = reactive([
]); ]);
const handleScenePhoto = (id: string) => { const handleScenePhoto = (id: string) => {
uni.navigateTo({ uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, // url: "/pagesScenePhoto/index?orderType=2&imagesType=1&id=" + id, //
}); });
}; };
const getScaleStatus = (type: number) => { const getScaleStatus = (type: number) => {

View File

@ -71,7 +71,7 @@ const handleModal = (v: boolean, id: number) => {
deleteId.value = id; deleteId.value = id;
}; };
const handleOk = () => { const handleOk = () => {
deleteStockCard({id: deleteId.value}) deleteStockCard({ id: deleteId.value });
}; };
const state = reactive<any>({ const state = reactive<any>({
@ -131,17 +131,18 @@ const getList = (v?: boolean) => {
if (state.supplierTypeId > -1) { if (state.supplierTypeId > -1) {
params.supplierTypeId = state.supplierTypeId; params.supplierTypeId = state.supplierTypeId;
} }
StockCardApi.getStockCardList(params).then((res) => { pageList.isLoading = true;
StockCardApi.getStockCardList(params).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
if (res.code === 200) { pageList.isLoading = false;
(pageList as any).list = (res.data as any).list; pageList.list = pageList.list = pageList.list.concat(res.data.list);
} pageList.total = res.data.total;
} }
}); });
}; };
onShow(() => { onShow(() => {
resetPageList() resetPageList();
getList(); getList();
}); });
</script> </script>

View File

@ -169,8 +169,8 @@ import pinia from "@/store";
const store = useMemberStore(pinia); const store = useMemberStore(pinia);
const navbarRect = reactive({ const navbarRect = reactive({
height: 32, height: 42,
top: 28, top: 48,
safeHeight: 500, safeHeight: 500,
}); });
@ -393,7 +393,7 @@ const appList = reactive([
}, },
}, },
{ {
icon: "09.png", icon: "11.png",
title: "收货产品", title: "收货产品",
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
@ -411,7 +411,7 @@ const appList = reactive([
}, },
}, },
{ {
icon: "11.png", icon: "09.png",
title: "出货产品", title: "出货产品",
fn: () => { fn: () => {
uni.navigateTo({ uni.navigateTo({
@ -565,7 +565,21 @@ onMounted(() => {
// #endif // #endif
}); });
onShow(() => { onShow(() => {
if (store.profile?.token) {
init(); init();
} else {
//
if (Boolean(uni.getStorageSync("hasLaunched"))) {
//
uni.reLaunch({
url: "/pagesLogin/login/index",
});
} else {
//
uni.setStorageSync("hasLaunched", true);
uni.reLaunch({ url: "/pagesLaunch/index" });
}
}
}); });
</script> </script>
@ -656,7 +670,7 @@ onShow(() => {
// display: flex; // display: flex;
// align-items: center; // align-items: center;
position: relative; position: relative;
top: 50%; // top: 50%;
// transform: translateY(-50%); // transform: translateY(-50%);
.num { .num {
font-size: 32rpx; font-size: 32rpx;

View File

@ -1,5 +1,5 @@
<template> <template>
<NavBar :count="0" :title="'登'"></NavBar> <NavBar :count="0" :title="'登'"></NavBar>
<LoginLayout> <LoginLayout>
<template #form-box> <template #form-box>
<u-form <u-form
@ -9,6 +9,23 @@
ref="loginForm" ref="loginForm"
:labelWidth="0" :labelWidth="0"
> >
<u-form-item prop="userInfo.dpName" @click="state.isShow = true">
<u-input
v-model="model1.userInfo.dpName"
:placeholder="`请选择基地名称`"
clearable
:customStyle="{}"
border="none"
:disabledColor="''"
:disabled="true"
>
<!-- @change="(e:any) => {handleInput(e, item)}"
@clear="handleClear(item)" -->
</u-input>
<template #right>
<u-icon name="arrow-right" color="#dadbde"></u-icon>
</template>
</u-form-item>
<u-form-item prop="userInfo.userName"> <u-form-item prop="userInfo.userName">
<u-input <u-input
v-model="model1.userInfo.userName" v-model="model1.userInfo.userName"
@ -19,10 +36,11 @@
'border-color': 'border-color':
currentFocus === 'userName' ? '#00dcee !important' : '', currentFocus === 'userName' ? '#00dcee !important' : '',
}" }"
border="none"
type="number" type="number"
@focus="handleFocus('userName')" @focus="handleFocus('userName')"
@change="(e:any) => {handleInput(e, 'userName')}" @change="(e:any) => {handleInput(e, 'userName')}"
@clear="handleClear({key: 'userName'})" @clear="handleClear({ key: 'userName' })"
> >
</u-input> </u-input>
</u-form-item> </u-form-item>
@ -37,10 +55,11 @@
'border-color': 'border-color':
currentFocus === 'password' ? '#00dcee !important' : '', currentFocus === 'password' ? '#00dcee !important' : '',
}" }"
border="none"
@focus="handleFocus('password')" @focus="handleFocus('password')"
clearable clearable
@change="(e:any) => {handleInput(e, 'password')}" @change="(e:any) => {handleInput(e, 'password')}"
@clear="handleClear({key: 'password'})" @clear="handleClear({ key: 'password' })"
> >
<template #suffix> <template #suffix>
<image <image
@ -109,6 +128,15 @@
</view> </view>
</template> </template>
</LoginLayout> </LoginLayout>
<u-action-sheet
:actions="state.dpList"
:title="'基地名称'"
:show="state.isShow"
@select="(v: any) => handleSelect(v)"
@close="state.isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -116,8 +144,7 @@ import { ProfileApi } from "@/services/index";
import LoginLayout from "./components/loginLayout.vue"; import LoginLayout from "./components/loginLayout.vue";
import { useMemberStore } from "@/store/index"; import { useMemberStore } from "@/store/index";
import valid from "@/utils/validate"; import valid from "@/utils/validate";
import pinia from '@/store' import pinia from "@/store";
const handleClear = (item: any) => { const handleClear = (item: any) => {
setTimeout(() => { setTimeout(() => {
@ -130,6 +157,7 @@ const model1 = reactive({
userInfo: { userInfo: {
userName: "", userName: "",
password: "", password: "",
dpName: "",
}, },
}); });
// focus // focus
@ -143,6 +171,12 @@ const checkGroup = reactive({
}); });
const rules = ref({ const rules = ref({
"userInfo.dpName": {
type: "string",
required: true,
message: "请选择基地名称",
trigger: ["blur", "change"],
},
"userInfo.userName": { "userInfo.userName": {
type: "string", type: "string",
required: true, required: true,
@ -206,7 +240,7 @@ const submit = () => {
ProfileApi.loginByAccount(model1.userInfo).then((res: any) => { ProfileApi.loginByAccount(model1.userInfo).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
store.setProfile(res.data); store.setProfile(res.data);
uni.navigateTo({ uni.reLaunch({
url: "/pagesHome/index", // url: "/pagesHome/index", //
}); });
} }
@ -258,9 +292,36 @@ const openDoc = (item: string) => {
// }, // },
// }); // });
}; };
const handleSelect = (v: any) => {
state.isShow = false;
state.dpObj = v;
model1.userInfo.dpName = v.name;
console.log(v.dbIp);
store.setChildPath(v.dbIp);
};
const state = reactive({
dpList: [],
isShow: false,
dpObj: {},
});
//
ProfileApi.getDbInfo({}).then((res) => {
if (res.code === 200) {
state.dpList = res.data.map((item: any) => {
return { name: item.dbName, ...item };
});
}
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .u-form-item__body__right__content {
border-radius: 100px;
border: 1px solid #dadbde;
}
.custom-icon { .custom-icon {
width: 37.18rpx; width: 37.18rpx;
height: 18.59rpx; height: 18.59rpx;

View File

@ -551,10 +551,15 @@ watch(
} }
} }
model1.order.totalPrice = model1.order.totalPrice =
(model1.order.price || 0) * (model1.order.netWeight || 0); Math.round(
(model1.order.price || 0) * (model1.order.netWeight || 0) * 100
) / 100;
// = // =
if (<number>model1.order.balanceTotalPrice <= 0) {
model1.order.balanceTotalPrice = model1.order.totalPrice; model1.order.balanceTotalPrice = model1.order.totalPrice;
} }
}
); );
// SupplierApi.getSupplierUserList({}).then((res) => { // SupplierApi.getSupplierUserList({}).then((res) => {
@ -562,16 +567,16 @@ watch(
// contrlModalParams.userSelect.list = res.data; // contrlModalParams.userSelect.list = res.data;
// } // }
// }); // });
ReceiveProductApi.getAllReProducts().then((res) => { // ReceiveProductApi.getAllReProducts().then((res) => {
if (res.code === 200) { // if (res.code === 200) {
contrlModalParams.productSelect.list = _.map( // contrlModalParams.productSelect.list = _.map(
res.data as any, // res.data as any,
function (item: any) { // function (item: any) {
return { name: item.reProductsName, ...item }; // return { name: item.reProductsName, ...item };
} // }
); // );
} // }
}); // });
const handleSelect = (key: string, v: any) => { const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false; contrlModalParams[key].isShow = false;
if (key === "userSelect") { if (key === "userSelect") {
@ -590,7 +595,6 @@ const handleBack = () => {
// const files = ref<FileObj[]>([]); // const files = ref<FileObj[]>([]);
const filesRef = ref(); const filesRef = ref();
const handleUpload = () => { const handleUpload = () => {
// console.log(event.tempFilePaths)
return filesRef.value[0].filesList.map((item: any, index: number) => { return filesRef.value[0].filesList.map((item: any, index: number) => {
if (item.fileID) { if (item.fileID) {
return; return;
@ -621,7 +625,6 @@ const handleUpload = () => {
* *
*/ */
const handleDelete = (e: any) => { const handleDelete = (e: any) => {
console.log(model1.order.fileLists);
if (e.tempFile.fileID) { if (e.tempFile.fileID) {
PictureApi.deleteById({ id: e.tempFile.fileID }).then((res) => { PictureApi.deleteById({ id: e.tempFile.fileID }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
@ -703,9 +706,14 @@ const save = () => {
}; };
const startSave = () => { const startSave = () => {
Promise.all(handleUpload()).then((res) => { Promise.all(handleUpload()).then((res) => {
console.log("***** 所有文件已经上传成功", res);
if (res.filter((item) => item).length > 0) { if (res.filter((item) => item).length > 0) {
PictureApi.addListAnnex({ annexPos: res.filter((item) => item) }).then( PictureApi.addListAnnex({ annexPos: res.filter((item) => item) }).then(
(res1) => { (res1) => {
console.log(
"***** 关联的内容是",
res.filter((item) => item)
);
if (res1.code === 200) { if (res1.code === 200) {
console.log("*** 资源文件更新成功"); console.log("*** 资源文件更新成功");
} }
@ -724,6 +732,8 @@ const updateOrder = () => {
零皮重 scaleState = 2 带审核 零皮重 scaleState = 2 带审核
*/ */
// //
//
if (<number>model1.order.scaleStatus < 2) {
if (!model1.order.repairFlag) { if (!model1.order.repairFlag) {
if (model1.order.weighingMethod === 0) { if (model1.order.weighingMethod === 0) {
model1.order.scaleStatus = 1; model1.order.scaleStatus = 1;
@ -731,6 +741,7 @@ const updateOrder = () => {
model1.order.scaleStatus = 2; model1.order.scaleStatus = 2;
} }
} }
}
// //
/** /**
@ -802,7 +813,7 @@ onLoad((option) => {
}); });
PictureApi.getAnnex({ PictureApi.getAnnex({
businessId: model1.order.id.toString(), businessId: model1.order.id.toString(),
orderType: 1, orderType: OrderType.Receive,
imagesType: ImagesType.NORMARL, imagesType: ImagesType.NORMARL,
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
@ -812,7 +823,7 @@ onLoad((option) => {
} }
uni.$on("pricingParams", (data) => { uni.$on("pricingParams", (data) => {
model1.order.userName = data.name model1.order.userName = data.name;
}); });
}); });

View File

@ -210,6 +210,7 @@ const resetPageList = () => {
}; };
const currentTab = ref(2); const currentTab = ref(2);
const handleTab = (item: any) => { const handleTab = (item: any) => {
state.isAll = false;
currentTab.value = item.key; currentTab.value = item.key;
resetPageList(); resetPageList();
getList(); getList();
@ -288,12 +289,14 @@ const getList = (v?: boolean) => {
pageNumber: pageList.pageNum, pageNumber: pageList.pageNum,
scaleStatus: currentTab.value, scaleStatus: currentTab.value,
userName: keyword.value userName: keyword.value
}).then((res) => { }).then((res:any) => {
if (res.code === 200) { if (res.code === 200) {
pageList.isLoading = false; pageList.isLoading = false;
(pageList as any).list = (res.data.list as any).map((item: any) => { pageList.list = pageList.list.concat(
res.data.list.map((item: any) => {
return { ...item, isChecked: false }; return { ...item, isChecked: false };
}); })
);
pageList.total = (res.data as any).total; pageList.total = (res.data as any).total;
} }
}); });

View File

@ -151,6 +151,7 @@ const getList = (v?: boolean) => {
const handleOk = () => { const handleOk = () => {
ReceiveApi.deleteOrder({ ids: [deleteId.value] }).then((res) => { ReceiveApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
resetPageList();
getList(); getList();
} }
}); });

View File

@ -299,7 +299,9 @@ const handleScenePhoto = (id: any) => {
}; };
// // 3 // // 3
const handleReviewNoPay = () => { const handleReviewNoPay = () => {
ReceiveApi.updateOne({ ...state.order, scaleStatus: 3 }).then((res) => { ReceiveApi.updateOrderIn({
orderInPos: [{ ...state.order, scaleStatus: 3 }],
}).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.redirectTo({ uni.redirectTo({
url: "/pagesReceive/payReview?scaleStatus=3", // url: "/pagesReceive/payReview?scaleStatus=3", //
@ -366,7 +368,7 @@ const handleOk = () => {
ReceiveApi.deleteOrder({ ids: [deleteId.value] }).then((res) => { ReceiveApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.redirectTo({ uni.redirectTo({
url: "/pagesReceive/payReview?scaleStatus=2", // url: "/pagesReceive/payReview?scaleStatus=" + state.scaleStatus, //
}); });
} }
}); });
@ -395,12 +397,12 @@ const handlePrint = () => {
DeviceApi.print({ DeviceApi.print({
id: state.order.id, id: state.order.id,
orderType: OrderType.Receive, orderType: OrderType.Receive,
userId: state.order.deviceId userId: state.order.deviceId,
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: "打印成功", title: "打印成功",
}) });
} }
}); });
}; };
@ -434,7 +436,15 @@ onLoad((option) => {
state.order[item.enName] = state.order["totalPrice"]; state.order[item.enName] = state.order["totalPrice"];
} }
} else { } else {
if (item.enName === "buckleMiscellaneous") {
if (state.order[item.enName as string]) {
item.num = state.order[item.enName as string]; item.num = state.order[item.enName as string];
} else {
item.num = 0;
}
} else {
item.num = state.order[item.enName as string];
}
} }
}); });
} }

View File

@ -113,7 +113,14 @@ const handleClear = (item: any) => {
}; };
const isShowFormItem = (item: any) => { const isShowFormItem = (item: any) => {
if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay) { if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay) {
if (
model1.order.deliveryMethod === 1 &&
["freight", "incidentals"].indexOf(item.key) > -1
) {
return false;
} else {
return true; return true;
}
} else { } else {
return ( return (
item.key !== "paymentMethodName" && item.key !== "paymentMethodName" &&
@ -636,6 +643,8 @@ const updateOrder = () => {
icon: "success", icon: "success",
}); });
//
if (scaleStatus.value === ScaleStatus.ToBeShipmentPay) {
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
success: (res) => { success: (res) => {
@ -646,6 +655,12 @@ const updateOrder = () => {
}, },
}); });
} }
if (scaleStatus.value === ScaleStatus.ShipmentPaid) {
uni.redirectTo({
url: "/pagesShipment/shipmentSettlement?scaleStatus=4", //
});
}
}
}); });
}; };

View File

@ -418,7 +418,6 @@ const updateOrder = () => {
// else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) { // else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) {
// status = ScaleStatus.ToBeShipmentReview; // status = ScaleStatus.ToBeShipmentReview;
// } // }
debugger
let status = 0; let status = 0;
if (state.scaleStatus === ScaleStatus.ToBeShipment) { if (state.scaleStatus === ScaleStatus.ToBeShipment) {
status = ScaleStatus.ToBeGrossWeight; status = ScaleStatus.ToBeGrossWeight;

View File

@ -80,7 +80,6 @@ const handleScenePhoto = (imagesId: number) => {
}; };
const pricingDetail = (id: string) => { const pricingDetail = (id: string) => {
// //
debugger
ShipmentApi.getDetailById({ id: id }).then((res: any) => { ShipmentApi.getDetailById({ id: id }).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
if (res.data.scaleStatus > 1) { if (res.data.scaleStatus > 1) {
@ -120,9 +119,9 @@ const getList = (v?: boolean) => {
}); });
}; };
const handleOk = () => { const handleOk = () => {
console.log(deleteId.value);
ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => { ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
resetPageList();
getList(); getList();
} }
}); });

View File

@ -539,7 +539,9 @@ const handleOk = () => {
ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => { ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/shipmentSettlement?scaleStatus=2", // url:
"/pagesShipment/shipmentSettlement?scaleStatus=" +
state.scaleStatus, //
}); });
} }
}); });
@ -591,22 +593,22 @@ const handlePrint = () => {
DeviceApi.print({ DeviceApi.print({
id: state.order.id, id: state.order.id,
orderType: OrderType.Shipment, orderType: OrderType.Shipment,
userId: state.order.deviceId userId: state.order.deviceId,
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: "打印成功", title: "打印成功",
}) });
} }
}); });
}; };
onShow(() => { onShow(() => {
init(); init();
}); });
onLoad((option) => { onLoad((option:any) => {
state.order.id = (option as any).id; state.order.id = (option as any).id;
state.scaleStatusBtnType = parseInt((option as any).scaleStatusBtnType); state.scaleStatusBtnType = parseInt((option as any).scaleStatusBtnType);
state.scaleStatus = parseInt(option.scaleStatus);
uni.$on("shipmentReviewUrlParams", (data) => { uni.$on("shipmentReviewUrlParams", (data) => {
console.log(data); console.log(data);
state.order.id = data.id; state.order.id = data.id;

View File

@ -37,7 +37,12 @@
" "
:noMoreData="pageList.noMoreData" :noMoreData="pageList.noMoreData"
:list="pageList.list" :list="pageList.list"
:height="ScaleStatus.ShipmentPaid === currentTab ? 160 : 240" :height="
ScaleStatus.ShipmentPaid === currentTab ||
ScaleStatus.ToBeShipmentReview === currentTab
? 160
: 240
"
:isLoading="pageList.isLoading" :isLoading="pageList.isLoading"
> >
<block v-for="(item, index) in pageList.list" :key="index"> <block v-for="(item, index) in pageList.list" :key="index">
@ -45,7 +50,6 @@
<view style="min-width: 20px" <view style="min-width: 20px"
><checkbox ><checkbox
v-if=" v-if="
ScaleStatus.ToBeShipmentReview === currentTab ||
ScaleStatus.ToBeShipmentPay === currentTab ScaleStatus.ToBeShipmentPay === currentTab
" "
:color="'#00D2E3'" :color="'#00D2E3'"
@ -102,10 +106,7 @@
</block> </block>
</page-view> </page-view>
</view> </view>
<view <view class="btn-box" v-if="currentTab === 3 && pageList.list.length > 0">
class="btn-box"
v-if="(currentTab === 2 || currentTab === 3) && pageList.list.length > 0"
>
<u-button <u-button
text="全选/取消" text="全选/取消"
color="#fff" color="#fff"
@ -114,10 +115,21 @@
></u-button> ></u-button>
<u-button <u-button
type="primary" type="primary"
:text="`${currentTab === 2 ? '批量审核' : '批量支付'}`" :text="`批量支付`"
@click="handleReviewOrPay(currentTab)" @click="handleReviewOrPay()"
></u-button> ></u-button>
</view> </view>
<block>
<u-action-sheet
:actions="contrlModalParams.select.list"
:title="contrlModalParams.select.title"
:show="contrlModalParams.select.isShow"
@select="(v: any) => handleSelect1('select', v)"
@close="contrlModalParams.select.isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ShipmentApi } from "@/services/index"; import { ShipmentApi } from "@/services/index";
@ -125,6 +137,43 @@ import { ScaleStatus, ScaleStatusBtnType } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import PageView from "@/components/PageView/index.vue"; import PageView from "@/components/PageView/index.vue";
import type { ComType } from "@/types/global";
const contrlModalParams = reactive<ComType>({
select: {
isShow: false,
title: "标题",
list: [
{
name: "微信",
key: 3,
},
{
name: "现金",
key: 1,
},
{
name: "支付宝",
key: 4,
},
{
name: "转账",
key: 2,
},
],
},
});
const payState = reactive({
paymentMethodName: "",
paymentMethod: "",
});
const handleSelect1 = (key: string, v: any) => {
contrlModalParams.select.isShow = false;
payState.paymentMethodName = v.name;
payState.paymentMethod = v.key;
updateStatus(ScaleStatus.ShipmentPaid);
};
// scaleStatus // scaleStatus
const pageList: PageResult<Shipment> = reactive({ const pageList: PageResult<Shipment> = reactive({
isLoading: false, isLoading: false,
@ -158,6 +207,7 @@ const tabList = reactive([
]); ]);
const currentTab = ref(2); const currentTab = ref(2);
const handleTab = (item: any) => { const handleTab = (item: any) => {
state.isAll = false;
currentTab.value = item.key; currentTab.value = item.key;
resetPageList(); resetPageList();
getList(); getList();
@ -171,26 +221,35 @@ const handleReview = (id: string, scaleStatus: number) => {
} else if (scaleStatus === 4) { } else if (scaleStatus === 4) {
type = ScaleStatusBtnType.ShipmentPay; type = ScaleStatusBtnType.ShipmentPay;
} }
console.log("**************", type);
uni.navigateTo({ uni.navigateTo({
url: "/pagesShipment/review/index?id=" + id + `&scaleStatusBtnType=${type}`, // url:
"/pagesShipment/review/index?id=" +
id +
`&scaleStatusBtnType=${type}&scaleStatus=${scaleStatus}`, //
}); });
}; };
const handleReviewOrPay = (status: number) => { const handleReviewOrPay = () => {
// const list = pageList.list
if (ScaleStatus.ToBeShipmentReview === status) { .filter((item) => item.isChecked)
updateStatus(ScaleStatus.ToBeShipmentPay); if (list.length === 0) {
} else if (ScaleStatus.ToBeShipmentPay === status) { uni.showToast({ icon: "none", title: "请至少选择一个出货单" });
// return;
updateStatus(ScaleStatus.ShipmentPaid);
} }
//
contrlModalParams.select.isShow = true;
contrlModalParams.select.title = "结算方式";
}; };
const updateStatus = (status: number) => { const updateStatus = (status: number) => {
const list = pageList.list const list = pageList.list
.filter((item) => item.isChecked) .filter((item) => item.isChecked)
.map((item) => { .map((item) => {
return { ...item, scaleStatus: status }; return {
...item,
scaleStatus: status,
paymentMethodName: payState.paymentMethodName,
paymentMethod: payState.paymentMethod,
};
}); });
if (list.length === 0) { if (list.length === 0) {
uni.showToast({ icon: "none", title: "请至少选择一个出货单" }); uni.showToast({ icon: "none", title: "请至少选择一个出货单" });
@ -243,8 +302,8 @@ const getList = (v?: boolean) => {
// (pageList as any).list = (res.data.list as any).map((item: any) => { // (pageList as any).list = (res.data.list as any).map((item: any) => {
// return { ...item, isChecked: false }; // return { ...item, isChecked: false };
// }); // });
(pageList as any).list = (pageList as any).list.concat( pageList.list = pageList.list.concat(
(res.data.list as any).map((item: any) => { res.data.list.map((item: any) => {
return { ...item, isChecked: false }; return { ...item, isChecked: false };
}) })
); );
@ -253,7 +312,7 @@ const getList = (v?: boolean) => {
}); });
}; };
onShow(() => { onShow(() => {
resetPageList() resetPageList();
getList(); getList();
}); });
onLoad((option) => { onLoad((option) => {

View File

@ -98,7 +98,7 @@ const handleModal = (v: boolean, id: number) => {
}; };
const handleScenePhoto = (id: any) => { const handleScenePhoto = (id: any) => {
uni.navigateTo({ uni.navigateTo({
url: `/pagesScenePhoto/index?orderType=1&id=${id}&imagesType=1`, // url: `/pagesScenePhoto/index?orderType=2&id=${id}&imagesType=1`, //
}); });
}; };
const pricingDetail = (id: string) => { const pricingDetail = (id: string) => {
@ -145,6 +145,7 @@ const handleOk = () => {
console.log(deleteId.value); console.log(deleteId.value);
ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => { ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
resetPageList();
getList(); getList();
} }
}); });

View File

@ -1,8 +1,10 @@
// 存放路径: src/services/home.ts // 存放路径: src/services/home.ts
// import { useMemberStore } from "@/store/modules/member";
// import pinia from "@/store";
// const store = useMemberStore(pinia);
import type { User } from "@/types/user"; import type { User } from "@/types/user";
import { http } from "@/utils/http"; import { http } from "@/utils/http";
// console.log(store.profile.childPath)
// 登陆 // 登陆
export const loginByAccount = (data: { export const loginByAccount = (data: {
userName: string; userName: string;
@ -250,3 +252,13 @@ export const forgetPwd = (data: any) => {
data, data,
}); });
}; };
// 获取基地信息
export const getDbInfo = (data: any) => {
return http<User>({
method: "POST",
url: "/prod/gateway/api/db/getDbInfo",
data,
});
};

View File

@ -8,31 +8,55 @@ export const useMemberStore = defineStore(
() => { () => {
// 会员信息 // 会员信息
const profile = ref<LoginResult>({ const profile = ref<LoginResult>({
token: '', token: "",
userInfo: { userInfo: {
userName: "", userName: "",
factoryName: "", factoryName: "",
}, },
menusList:[], menusList: [],
menusNameList: [] menusNameList: [],
childPath: '/test/sh0001',
err: null
}); });
// 保存会员信息,登录时使用 // 保存会员信息,登录时使用
const setProfile = (val: any) => { const setProfile = (val: any) => {
profile.value = val; profile.value = {...profile.value, ...val};
profile.value.menusNameList = _.pluck(val.menusList, "name"); profile.value.menusNameList = _.pluck(val.menusList, "name");
}; };
const setChildPath= (v: string) => {
profile.value.childPath = v
}
const setErr= (v: any) => {
profile.value.err = v
}
// 清理会员信息,退出时使用 // 清理会员信息,退出时使用
const clearProfile = () => { const clearProfile = () => {
// profile.value = undefined profile.value = {
token: "",
userInfo: {
userName: "",
factoryName: "",
},
menusList: [],
menusNameList: [],
childPath: ''
};
}; };
// 记得 return // 记得 return
return { return {
profile, profile,
setProfile, setProfile,
clearProfile, setChildPath,
setErr,
clearProfile
}; };
}, },
{ {

View File

@ -1,6 +1,6 @@
import { useMemberStore } from "@/store/modules/member"; import { useMemberStore } from "@/store/modules/member";
import ENV_CONFIG from "../config/env"; import ENV_CONFIG from "../config/env";
import pinia from '@/store' import pinia from "@/store";
// 基础地址 // 基础地址
let baseUrl = ""; let baseUrl = "";
@ -8,11 +8,10 @@ let baseUrl = "";
(process.env as any).config = ENV_CONFIG; (process.env as any).config = ENV_CONFIG;
// #endif // #endif
const store = useMemberStore(pinia);
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(pinia);
const obj = { const obj = {
// 拦截前触发 // 拦截前触发
invoke(options: UniApp.RequestOptions) { invoke(options: UniApp.RequestOptions) {
@ -20,8 +19,12 @@ const obj = {
options.timeout = 10000; options.timeout = 10000;
// 拼接完整路径 // 拼接完整路径
if (!options.url.startsWith("http")) { if (!options.url.startsWith("http")) {
if (options.url.indexOf("/prod/gateway/api/db/getDbInfo") === -1) {
options.url = baseUrl + store.profile.childPath + options.url;
} else {
options.url = baseUrl + options.url; options.url = baseUrl + options.url;
} }
}
// 请求头标识 // 请求头标识
// 1.小程序唯一标识 // 1.小程序唯一标识
// 'source-client' 'miniapp' // 'source-client' 'miniapp'
@ -53,8 +56,13 @@ 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") { if ((options as any).header?.type === "UPLOAD") {
// 压缩图片
uni.compressImage({
src: (options as any).data.path,
quality: 80, // 压缩质量
success: (compressRes) => {
const compressedTempFilePath = compressRes.tempFilePath;
uni.uploadFile({ uni.uploadFile({
header: { header: {
"x-userToken": store.profile?.token, "x-userToken": store.profile?.token,
@ -62,13 +70,14 @@ export const http = <T>(options: UniApp.RequestOptions) => {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
// #endif // #endif
}, },
url: baseUrl + options.url, //仅为示例,非真实的接口地址 timeout: 1800000,
url: baseUrl + store.profile.childPath + options.url,//仅为示例,非真实的接口地址
fileType: "image", fileType: "image",
// #ifdef H5 // #ifdef H5
files: (options as any).data.files, files: (options as any).data.files,
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
filePath: (options as any).data.path, filePath: compressedTempFilePath,
// #endif // #endif
name: "file", name: "file",
formData: { formData: {
@ -78,25 +87,80 @@ export const http = <T>(options: UniApp.RequestOptions) => {
resolve(JSON.parse(res.data) as Data<T>); resolve(JSON.parse(res.data) as Data<T>);
}, },
fail(err) { fail(err) {
console.log(err); console.log("上传失败了", err);
resolve(err as any) resolve(err as any);
}, },
}); });
// 上传图片
// uni.uploadFile({
// url: 'https://your-api-upload-endpoint.com/upload', // 你的上传接口
// filePath: compressedTempFilePath,
// name: 'file',
// formData: {
// 'user': 'test'
// },
// success: (uploadFileRes) => {
// console.log('upload success:', uploadFileRes);
// },
// fail: (uploadFileErr) => {
// console.error('upload fail:', uploadFileErr);
// }
// });
},
fail: (compressErr) => {
console.error("compress fail:", compressErr);
},
});
// uni.uploadFile({
// header: {
// "x-userToken": store.profile?.token,
// // #ifdef H5
// "Content-Type": "multipart/form-data",
// // #endif
// },
// timeout: 1800000,
// url: baseUrl + store.profile.childPath + 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);
// resolve(err as any);
// },
// });
} else { } else {
uni.request({ uni.request({
...options, ...options,
dataType:'string', //1.先将dataType设置为string dataType: "string", //1.先将dataType设置为string
success(res) { success(res) {
var json=(res.data as any).replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2') var json = (res.data as any).replace(
/:s*([0-9]{15,})s*(,?)/g,
': "$1" $2'
);
//2.根据后端返回的数据调用一次或者两次replace替换 //2.根据后端返回的数据调用一次或者两次replace替换
var json1=json.replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2') var json1 = json.replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2');
//3.手动转换回json数据即可 //3.手动转换回json数据即可
let res1 = JSON.parse(json1); let res1: any = JSON.parse(json1);
console.log(res1) console.log(res1);
if (res.statusCode >= 200 && res.statusCode < 300) { if (res.statusCode >= 200 && res.statusCode < 300) {
if ( if (
(res1 as any).code === 1001 || res1.code === 1001 ||
(res1 as any).code === 1002 res1.code === 1002 ||
res1.code === 1003 ||
res1.code === 1004
) { ) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
@ -107,12 +171,12 @@ export const http = <T>(options: UniApp.RequestOptions) => {
url: "/pagesLogin/login/index", url: "/pagesLogin/login/index",
}); });
return; return;
}else if ((res1 as any).code === 10001) { } else if ((res1 as any).code === 10001) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: (res1 as Data<T>).message || "请求失败", title: (res1 as Data<T>).message || "请求失败",
}); });
return return;
} else if ((res1 as any).code === 5001) { } else if ((res1 as any).code === 5001) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
@ -131,6 +195,7 @@ export const http = <T>(options: UniApp.RequestOptions) => {
fail(err) { fail(err) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
// title: JSON.stringify(err),
title: "网络错误,请检查网络", title: "网络错误,请检查网络",
}); });
reject(err); reject(err);

View File

@ -259,3 +259,4 @@ export function getScaleStatus(type: number, value: number) {
} }
} }
} }