Compare commits
No commits in common. "447d9ab591c3635acbaae8c8f891515e1d3b84de" and "f433f725cd42428f6437f303ade0f1a89a386fd1" have entirely different histories.
447d9ab591
...
f433f725cd
26
src/App.vue
26
src/App.vue
|
@ -1,21 +1,19 @@
|
||||||
<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(Boolean(uni.getStorageSync("hasLaunched")))
|
console.log("App Launch");
|
||||||
// // 当应用启动时,检查是否已显示过启动页
|
// 当应用启动时,检查是否已显示过启动页
|
||||||
// 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");
|
||||||
|
|
|
@ -26,9 +26,7 @@
|
||||||
<view
|
<view
|
||||||
>{{ state.type === "1" ? "应付" : "应收" }}金额:<text class="num"
|
>{{ state.type === "1" ? "应付" : "应收" }}金额:<text class="num"
|
||||||
>¥{{
|
>¥{{
|
||||||
state.type === "1"
|
state.type === "1" ? formatMoney(item.balanceTotalPrice) : formatMoney(item.totalPrice)
|
||||||
? formatMoney(item.balanceTotalPrice)
|
|
||||||
: formatMoney(item.totalPrice)
|
|
||||||
}}</text
|
}}</text
|
||||||
></view
|
></view
|
||||||
>
|
>
|
||||||
|
@ -87,25 +85,22 @@ 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.list = pageList.list.concat(
|
(pageList as any).list = (res.data.list as any).map((item: any) => {
|
||||||
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) => {
|
||||||
pageList.list = pageList.list.concat(
|
return { ...item, isChecked: false };
|
||||||
res.data.list.map((item: any) => {
|
});
|
||||||
return { ...item, isChecked: false };
|
|
||||||
})
|
|
||||||
);
|
|
||||||
pageList.total = (res.data as any).total;
|
pageList.total = (res.data as any).total;
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,12 @@ 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) {
|
||||||
state.list = res.data;
|
if (res.code === 200) {
|
||||||
|
state.list = res.data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -49,6 +49,7 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
const emit = defineEmits(["handleDialog", "changeProduct"]);
|
const emit = defineEmits(["handleDialog", "changeProduct"]);
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
debugger
|
||||||
emit("handleDialog", false);
|
emit("handleDialog", false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ const gridList2 = reactive([
|
||||||
]);
|
]);
|
||||||
const handleScenePhoto = (id: string) => {
|
const handleScenePhoto = (id: string) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pagesScenePhoto/index?orderType=2&imagesType=1&id=" + id, // 要跳转到的页面路径
|
url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, // 要跳转到的页面路径
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const state = reactive<any>({
|
const state = reactive<any>({
|
||||||
|
|
|
@ -19,8 +19,8 @@ const props = withDefaults(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const navbarRect = reactive({
|
const navbarRect = reactive({
|
||||||
height: 42,
|
height: 32,
|
||||||
top: 48,
|
top: 28,
|
||||||
safeHeight: 500,
|
safeHeight: 500,
|
||||||
});
|
});
|
||||||
const getSafeHeight = () => {
|
const getSafeHeight = () => {
|
||||||
|
|
|
@ -67,8 +67,8 @@ const props = withDefaults(
|
||||||
);
|
);
|
||||||
|
|
||||||
const navbarRect = reactive({
|
const navbarRect = reactive({
|
||||||
height: 42,
|
height: 32,
|
||||||
top: 48,
|
top: 28,
|
||||||
msgCount: 10,
|
msgCount: 10,
|
||||||
});
|
});
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const navbarRect = reactive({
|
const navbarRect = reactive({
|
||||||
height: 42,
|
height: 32,
|
||||||
top: 48,
|
top: 28,
|
||||||
msgCount: 10,
|
msgCount: 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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://cloud.52zaisheng.cn',
|
VITE_APP_BASE_URL: 'https://ifanda.52zaisheng.cn/prod',
|
||||||
appid: 'wx9251d74fe0e87028',
|
appid: 'wx9251d74fe0e87028',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ const test = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const production = {
|
const production = {
|
||||||
VITE_APP_BASE_URL: 'https://cloud.52zaisheng.cn',
|
VITE_APP_BASE_URL: 'https://ifanda.52zaisheng.cn/prod',
|
||||||
appid: 'wx9251d74fe0e87028',
|
appid: 'wx9251d74fe0e87028',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,11 @@
|
||||||
"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" : {
|
||||||
"compatible" : {
|
"ignoreVersion": false,
|
||||||
"ignoreVersion" : true
|
|
||||||
},
|
|
||||||
"usingComponents" : true,
|
"usingComponents" : true,
|
||||||
"nvueStyleCompiler" : "uni-app",
|
"nvueStyleCompiler" : "uni-app",
|
||||||
"compilerVersion" : 3,
|
"compilerVersion" : 3,
|
||||||
|
|
|
@ -83,10 +83,8 @@ 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 (minPrice > maxPrice) {
|
if (model1.formData.minPrice > model1.formData.maxPrice) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `${item.name}应小于${model1.formData.maxPrice}`,
|
title: `${item.name}应小于${model1.formData.maxPrice}`,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
|
@ -95,10 +93,10 @@ const handleInput = (e: any, item: any) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.key === "commonPrice") {
|
if (item.key === "commonPrice") {
|
||||||
if (minPrice > -1 && maxPrice > -1) {
|
if (model1.formData.minPrice > -1 && model1.formData.maxPrice > -1) {
|
||||||
if (
|
if (
|
||||||
!(temp >= minPrice &&
|
temp < model1.formData.minPrice ||
|
||||||
temp <= maxPrice)
|
temp > model1.formData.maxPrice
|
||||||
) {
|
) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `${item.name}应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`,
|
title: `${item.name}应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`,
|
||||||
|
@ -255,20 +253,16 @@ const check = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
const minPrice = parseFloat(model1.formData.minPrice)
|
if (model1.formData.minPrice > model1.formData.maxPrice) {
|
||||||
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 >= minPrice && temp <= maxPrice)) {
|
if (temp < model1.formData.minPrice || temp > model1.formData.maxPrice) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `常用价格应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`,
|
title: `常用价格应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
|
@ -276,6 +270,7 @@ const save = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(model1.formData);
|
||||||
check().then((res) => {
|
check().then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
startSave();
|
startSave();
|
||||||
|
|
|
@ -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: any) => {
|
CustomerApi.getCustomUserPage(params).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
pageList.isLoading = false;
|
pageList.isLoading = false;
|
||||||
pageList.list = pageList.list = pageList.list.concat(res.data.list);
|
(pageList as any).list = (res.data as any).list;
|
||||||
pageList.total = res.data.total;
|
pageList.total = (res.data as any).total;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
resetPageList();
|
resetPageList()
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
<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)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
<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)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -40,8 +40,7 @@
|
||||||
<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">
|
||||||
|
|
|
@ -496,6 +496,7 @@ 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") {
|
||||||
|
|
|
@ -25,19 +25,15 @@
|
||||||
:isLoading="pageList.isLoading"
|
:isLoading="pageList.isLoading"
|
||||||
>
|
>
|
||||||
<view class="box">
|
<view class="box">
|
||||||
<block v-for="(item, index) in pageList.list" :key="index">
|
<view 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 class="op-box">
|
|
||||||
<view class="btn" @click="edit(item)"> 编辑 </view>
|
|
||||||
<view class="btn" @click="handleModal(true, item.id)">
|
|
||||||
删除
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</block>
|
<view class="op-box">
|
||||||
|
<view class="btn" @click="edit(item)"> 编辑 </view>
|
||||||
|
<view class="btn" @click="handleModal(true, item.id)"> 删除 </view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</page-view>
|
</page-view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -64,7 +60,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>({
|
||||||
|
@ -72,7 +68,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,
|
||||||
|
@ -102,13 +98,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) => {
|
||||||
|
@ -126,14 +122,16 @@ 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) {
|
||||||
pageList.isLoading = false;
|
if (res.code === 200) {
|
||||||
(pageList as any).list = res.data as any;
|
pageList.isLoading = false;
|
||||||
|
(pageList as any).list = res.data as any;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
resetPageList();
|
resetPageList()
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -171,7 +171,7 @@ const gridList1 = reactive([
|
||||||
]);
|
]);
|
||||||
const handleScenePhoto = (id: string) => {
|
const handleScenePhoto = (id: string) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pagesScenePhoto/index?orderType=2&imagesType=1&id=" + id, // 要跳转到的页面路径
|
url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, // 要跳转到的页面路径
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -347,7 +347,7 @@ const gridList1 = reactive([
|
||||||
]);
|
]);
|
||||||
const handleScenePhoto = (id: string) => {
|
const handleScenePhoto = (id: string) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pagesScenePhoto/index?orderType=2&imagesType=1&id=" + id, // 要跳转到的页面路径
|
url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, // 要跳转到的页面路径
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const getScaleStatus = (type: number) => {
|
const getScaleStatus = (type: number) => {
|
||||||
|
|
|
@ -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,18 +131,17 @@ const getList = (v?: boolean) => {
|
||||||
if (state.supplierTypeId > -1) {
|
if (state.supplierTypeId > -1) {
|
||||||
params.supplierTypeId = state.supplierTypeId;
|
params.supplierTypeId = state.supplierTypeId;
|
||||||
}
|
}
|
||||||
pageList.isLoading = true;
|
StockCardApi.getStockCardList(params).then((res) => {
|
||||||
StockCardApi.getStockCardList(params).then((res: any) => {
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
pageList.isLoading = false;
|
if (res.code === 200) {
|
||||||
pageList.list = pageList.list = pageList.list.concat(res.data.list);
|
(pageList as any).list = (res.data as any).list;
|
||||||
pageList.total = res.data.total;
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
resetPageList();
|
resetPageList()
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -169,8 +169,8 @@ import pinia from "@/store";
|
||||||
|
|
||||||
const store = useMemberStore(pinia);
|
const store = useMemberStore(pinia);
|
||||||
const navbarRect = reactive({
|
const navbarRect = reactive({
|
||||||
height: 42,
|
height: 32,
|
||||||
top: 48,
|
top: 28,
|
||||||
safeHeight: 500,
|
safeHeight: 500,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ const appList = reactive([
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "11.png",
|
icon: "09.png",
|
||||||
title: "收货产品",
|
title: "收货产品",
|
||||||
fn: () => {
|
fn: () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
@ -411,7 +411,7 @@ const appList = reactive([
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "09.png",
|
icon: "11.png",
|
||||||
title: "出货产品",
|
title: "出货产品",
|
||||||
fn: () => {
|
fn: () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
@ -565,21 +565,7 @@ 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>
|
||||||
|
|
||||||
|
@ -670,7 +656,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;
|
||||||
|
|
|
@ -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,23 +9,6 @@
|
||||||
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"
|
||||||
|
@ -36,11 +19,10 @@
|
||||||
'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>
|
||||||
|
@ -55,11 +37,10 @@
|
||||||
'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
|
||||||
|
@ -128,15 +109,6 @@
|
||||||
</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">
|
||||||
|
@ -144,7 +116,8 @@ 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(() => {
|
||||||
|
@ -157,7 +130,6 @@ const model1 = reactive({
|
||||||
userInfo: {
|
userInfo: {
|
||||||
userName: "",
|
userName: "",
|
||||||
password: "",
|
password: "",
|
||||||
dpName: "",
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// 控制focus 边框样式
|
// 控制focus 边框样式
|
||||||
|
@ -171,12 +143,6 @@ 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,
|
||||||
|
@ -240,7 +206,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.reLaunch({
|
uni.navigateTo({
|
||||||
url: "/pagesHome/index", // 要跳转到的页面路径
|
url: "/pagesHome/index", // 要跳转到的页面路径
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -292,36 +258,9 @@ 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;
|
||||||
|
|
|
@ -551,14 +551,9 @@ watch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model1.order.totalPrice =
|
model1.order.totalPrice =
|
||||||
Math.round(
|
(model1.order.price || 0) * (model1.order.netWeight || 0);
|
||||||
(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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -567,16 +562,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") {
|
||||||
|
@ -595,6 +590,7 @@ 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;
|
||||||
|
@ -625,6 +621,7 @@ 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) {
|
||||||
|
@ -706,14 +703,9 @@ 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("*** 资源文件更新成功");
|
||||||
}
|
}
|
||||||
|
@ -732,14 +724,11 @@ const updateOrder = () => {
|
||||||
零皮重 scaleState = 2 带审核
|
零皮重 scaleState = 2 带审核
|
||||||
*/
|
*/
|
||||||
// 若是补单数据 则不做此判断
|
// 若是补单数据 则不做此判断
|
||||||
// 到待审核状态不用关心补单的逻辑
|
if (!model1.order.repairFlag) {
|
||||||
if (<number>model1.order.scaleStatus < 2) {
|
if (model1.order.weighingMethod === 0) {
|
||||||
if (!model1.order.repairFlag) {
|
model1.order.scaleStatus = 1;
|
||||||
if (model1.order.weighingMethod === 0) {
|
} else if (model1.order.weighingMethod === 1) {
|
||||||
model1.order.scaleStatus = 1;
|
model1.order.scaleStatus = 2;
|
||||||
} else if (model1.order.weighingMethod === 1) {
|
|
||||||
model1.order.scaleStatus = 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,7 +802,7 @@ onLoad((option) => {
|
||||||
});
|
});
|
||||||
PictureApi.getAnnex({
|
PictureApi.getAnnex({
|
||||||
businessId: model1.order.id.toString(),
|
businessId: model1.order.id.toString(),
|
||||||
orderType: OrderType.Receive,
|
orderType: 1,
|
||||||
imagesType: ImagesType.NORMARL,
|
imagesType: ImagesType.NORMARL,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
@ -823,7 +812,7 @@ onLoad((option) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.$on("pricingParams", (data) => {
|
uni.$on("pricingParams", (data) => {
|
||||||
model1.order.userName = data.name;
|
model1.order.userName = data.name
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,6 @@ 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();
|
||||||
|
@ -289,14 +288,12 @@ const getList = (v?: boolean) => {
|
||||||
pageNumber: pageList.pageNum,
|
pageNumber: pageList.pageNum,
|
||||||
scaleStatus: currentTab.value,
|
scaleStatus: currentTab.value,
|
||||||
userName: keyword.value
|
userName: keyword.value
|
||||||
}).then((res:any) => {
|
}).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
pageList.isLoading = false;
|
pageList.isLoading = false;
|
||||||
pageList.list = pageList.list.concat(
|
(pageList as any).list = (res.data.list as any).map((item: any) => {
|
||||||
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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -151,7 +151,6 @@ 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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -299,9 +299,7 @@ const handleScenePhoto = (id: any) => {
|
||||||
};
|
};
|
||||||
// 审核暂不支付 // 更新状态为3
|
// 审核暂不支付 // 更新状态为3
|
||||||
const handleReviewNoPay = () => {
|
const handleReviewNoPay = () => {
|
||||||
ReceiveApi.updateOrderIn({
|
ReceiveApi.updateOne({ ...state.order, scaleStatus: 3 }).then((res) => {
|
||||||
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", // 要跳转到的页面路径
|
||||||
|
@ -368,7 +366,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=" + state.scaleStatus, // 要跳转到的页面路径
|
url: "/pagesReceive/payReview?scaleStatus=2", // 要跳转到的页面路径
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -397,12 +395,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: "打印成功",
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -436,15 +434,7 @@ onLoad((option) => {
|
||||||
state.order[item.enName] = state.order["totalPrice"];
|
state.order[item.enName] = state.order["totalPrice"];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (item.enName === "buckleMiscellaneous") {
|
item.num = state.order[item.enName as string];
|
||||||
if (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];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,14 +113,7 @@ const handleClear = (item: any) => {
|
||||||
};
|
};
|
||||||
const isShowFormItem = (item: any) => {
|
const isShowFormItem = (item: any) => {
|
||||||
if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay) {
|
if (model1.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay) {
|
||||||
if (
|
return true;
|
||||||
model1.order.deliveryMethod === 1 &&
|
|
||||||
["freight", "incidentals"].indexOf(item.key) > -1
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
item.key !== "paymentMethodName" &&
|
item.key !== "paymentMethodName" &&
|
||||||
|
@ -581,7 +574,7 @@ const save = () => {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
parseFloat(model1.order.settlementTare.toString()) >
|
parseFloat(model1.order.settlementTare.toString()) >
|
||||||
parseFloat(model1.order.settlementGross.toString())
|
parseFloat(model1.order.settlementGross.toString())
|
||||||
|
@ -643,23 +636,15 @@ const updateOrder = () => {
|
||||||
icon: "success",
|
icon: "success",
|
||||||
});
|
});
|
||||||
|
|
||||||
// 根据不同的状态进入返回不同的页面
|
uni.navigateBack({
|
||||||
if (scaleStatus.value === ScaleStatus.ToBeShipmentPay) {
|
delta: 1,
|
||||||
uni.navigateBack({
|
success: (res) => {
|
||||||
delta: 1,
|
uni.$emit("shipmentReviewUrlParams", {
|
||||||
success: (res) => {
|
id: model1.order.id,
|
||||||
uni.$emit("shipmentReviewUrlParams", {
|
scaleStatusBtnType: model1.scaleStatusBtnType,
|
||||||
id: model1.order.id,
|
});
|
||||||
scaleStatusBtnType: model1.scaleStatusBtnType,
|
},
|
||||||
});
|
});
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (scaleStatus.value === ScaleStatus.ShipmentPaid) {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: "/pagesShipment/shipmentSettlement?scaleStatus=4", // 要跳转到的页面路径
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -418,6 +418,7 @@ 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;
|
||||||
|
|
|
@ -80,6 +80,7 @@ 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) {
|
||||||
|
@ -119,9 +120,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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -539,9 +539,7 @@ 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:
|
url: "/pagesShipment/shipmentSettlement?scaleStatus=2", // 要跳转到的页面路径
|
||||||
"/pagesShipment/shipmentSettlement?scaleStatus=" +
|
|
||||||
state.scaleStatus, // 要跳转到的页面路径
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -593,22 +591,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:any) => {
|
onLoad((option) => {
|
||||||
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;
|
||||||
|
|
|
@ -37,12 +37,7 @@
|
||||||
"
|
"
|
||||||
:noMoreData="pageList.noMoreData"
|
:noMoreData="pageList.noMoreData"
|
||||||
:list="pageList.list"
|
:list="pageList.list"
|
||||||
:height="
|
:height="ScaleStatus.ShipmentPaid === currentTab ? 160 : 240"
|
||||||
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">
|
||||||
|
@ -50,6 +45,7 @@
|
||||||
<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'"
|
||||||
|
@ -106,7 +102,10 @@
|
||||||
</block>
|
</block>
|
||||||
</page-view>
|
</page-view>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-box" v-if="currentTab === 3 && pageList.list.length > 0">
|
<view
|
||||||
|
class="btn-box"
|
||||||
|
v-if="(currentTab === 2 || currentTab === 3) && pageList.list.length > 0"
|
||||||
|
>
|
||||||
<u-button
|
<u-button
|
||||||
text="全选/取消"
|
text="全选/取消"
|
||||||
color="#fff"
|
color="#fff"
|
||||||
|
@ -115,21 +114,10 @@
|
||||||
></u-button>
|
></u-button>
|
||||||
<u-button
|
<u-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:text="`批量支付`"
|
:text="`${currentTab === 2 ? '批量审核' : '批量支付'}`"
|
||||||
@click="handleReviewOrPay()"
|
@click="handleReviewOrPay(currentTab)"
|
||||||
></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";
|
||||||
|
@ -137,43 +125,6 @@ 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,
|
||||||
|
@ -207,7 +158,6 @@ 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();
|
||||||
|
@ -221,35 +171,26 @@ 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:
|
url: "/pagesShipment/review/index?id=" + id + `&scaleStatusBtnType=${type}`, // 要跳转到的页面路径
|
||||||
"/pagesShipment/review/index?id=" +
|
|
||||||
id +
|
|
||||||
`&scaleStatusBtnType=${type}&scaleStatus=${scaleStatus}`, // 要跳转到的页面路径
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleReviewOrPay = () => {
|
const handleReviewOrPay = (status: number) => {
|
||||||
const list = pageList.list
|
// 批量审核
|
||||||
.filter((item) => item.isChecked)
|
if (ScaleStatus.ToBeShipmentReview === status) {
|
||||||
if (list.length === 0) {
|
updateStatus(ScaleStatus.ToBeShipmentPay);
|
||||||
uni.showToast({ icon: "none", title: "请至少选择一个出货单" });
|
} else if (ScaleStatus.ToBeShipmentPay === status) {
|
||||||
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 {
|
return { ...item, scaleStatus: status };
|
||||||
...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: "请至少选择一个出货单" });
|
||||||
|
@ -302,8 +243,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.list = pageList.list.concat(
|
(pageList as any).list = (pageList as any).list.concat(
|
||||||
res.data.list.map((item: any) => {
|
(res.data.list as any).map((item: any) => {
|
||||||
return { ...item, isChecked: false };
|
return { ...item, isChecked: false };
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -312,7 +253,7 @@ const getList = (v?: boolean) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
resetPageList();
|
resetPageList()
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
onLoad((option) => {
|
onLoad((option) => {
|
||||||
|
|
|
@ -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=2&id=${id}&imagesType=1`, // 要跳转到的页面路径
|
url: `/pagesScenePhoto/index?orderType=1&id=${id}&imagesType=1`, // 要跳转到的页面路径
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const pricingDetail = (id: string) => {
|
const pricingDetail = (id: string) => {
|
||||||
|
@ -145,7 +145,6 @@ 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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
// 存放路径: 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;
|
||||||
|
@ -252,13 +250,3 @@ export const forgetPwd = (data: any) => {
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取基地信息
|
|
||||||
export const getDbInfo = (data: any) => {
|
|
||||||
return http<User>({
|
|
||||||
method: "POST",
|
|
||||||
url: "/prod/gateway/api/db/getDbInfo",
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
|
@ -8,55 +8,31 @@ 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 = {...profile.value, ...val};
|
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 = {
|
// profile.value = undefined
|
||||||
token: "",
|
|
||||||
userInfo: {
|
|
||||||
userName: "",
|
|
||||||
factoryName: "",
|
|
||||||
},
|
|
||||||
menusList: [],
|
|
||||||
menusNameList: [],
|
|
||||||
childPath: ''
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 记得 return
|
// 记得 return
|
||||||
return {
|
return {
|
||||||
profile,
|
profile,
|
||||||
setProfile,
|
setProfile,
|
||||||
setChildPath,
|
clearProfile,
|
||||||
setErr,
|
|
||||||
clearProfile
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -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,10 +8,11 @@ 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) {
|
||||||
|
@ -19,11 +20,7 @@ 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 + options.url;
|
||||||
options.url = baseUrl + store.profile.childPath + options.url;
|
|
||||||
} else {
|
|
||||||
options.url = baseUrl + options.url;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 请求头标识
|
// 请求头标识
|
||||||
// 1.小程序唯一标识
|
// 1.小程序唯一标识
|
||||||
|
@ -56,111 +53,50 @@ 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.uploadFile({
|
||||||
uni.compressImage({
|
header: {
|
||||||
src: (options as any).data.path,
|
"x-userToken": store.profile?.token,
|
||||||
quality: 80, // 压缩质量
|
// #ifdef H5
|
||||||
success: (compressRes) => {
|
"Content-Type": "multipart/form-data",
|
||||||
const compressedTempFilePath = compressRes.tempFilePath;
|
// #endif
|
||||||
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: compressedTempFilePath,
|
|
||||||
// #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);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// 上传图片
|
|
||||||
// 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) => {
|
url: baseUrl + options.url, //仅为示例,非真实的接口地址
|
||||||
console.error("compress fail:", compressErr);
|
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)
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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(
|
var json=(res.data as any).replace(/:s*([0-9]{15,})s*(,?)/g, ': "$1" $2')
|
||||||
/: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: any = JSON.parse(json1);
|
let res1 = 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.code === 1001 ||
|
(res1 as any).code === 1001 ||
|
||||||
res1.code === 1002 ||
|
(res1 as any).code === 1002
|
||||||
res1.code === 1003 ||
|
|
||||||
res1.code === 1004
|
|
||||||
) {
|
) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: "none",
|
icon: "none",
|
||||||
|
@ -171,12 +107,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",
|
||||||
|
@ -195,7 +131,6 @@ 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);
|
||||||
|
|
|
@ -259,4 +259,3 @@ export function getScaleStatus(type: number, value: number) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue