update: 细节优化
This commit is contained in:
parent
b71988a8f0
commit
dc95484bf5
|
@ -3,7 +3,7 @@
|
|||
<u-form
|
||||
labelPosition="left"
|
||||
:model="model1"
|
||||
:rules="rules"
|
||||
:rules="model1.formData.id ? rules2 : rules1"
|
||||
ref="form"
|
||||
:labelWidth="100"
|
||||
:labelStyle="{ padding: '0rpx 10rpx' }"
|
||||
|
@ -13,7 +13,7 @@
|
|||
:prop="`formData.${item.key}`"
|
||||
:label="item.name"
|
||||
:required="item.required"
|
||||
v-for="(item, index) in formAttrList"
|
||||
v-for="(item, index) in model1.formData.id ? formAttrList2 : formAttrList1"
|
||||
:key="index"
|
||||
@click="item.fn"
|
||||
>
|
||||
|
@ -35,7 +35,9 @@
|
|||
:maxlength="item.key === 'password' ? 8 : -1"
|
||||
@change="(e:any) => {handleInput(e, item)}"
|
||||
:disabled="item.type === 'select'"
|
||||
:disabledColor="['性别', '用户角色'].indexOf(item.name) > -1?'#ffffff':'#f5f7fa'"
|
||||
:disabledColor="
|
||||
['性别', '用户角色'].indexOf(item.name) > -1 ? '#ffffff' : '#f5f7fa'
|
||||
"
|
||||
@clear="handleClear(item)"
|
||||
>
|
||||
<template #suffix>
|
||||
|
@ -49,7 +51,7 @@
|
|||
</template>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
<block v-for="(item, index) in formAttrList" :key="index">
|
||||
<block v-for="(item, index) in model1.formData.id ? formAttrList2 : formAttrList1" :key="index">
|
||||
<u-action-sheet
|
||||
v-if="item.type === 'select'"
|
||||
:actions="contrlModalParams[item.childKey].list"
|
||||
|
@ -73,8 +75,8 @@ import valid from "@/utils/validate";
|
|||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import _ from "underscore";
|
||||
const handleClear = (item: any) => {
|
||||
(model1.formData as any)[item.key] = '';
|
||||
}
|
||||
(model1.formData as any)[item.key] = "";
|
||||
};
|
||||
const handleInput = (e: any, item: any) => {
|
||||
if (item.key === "phone") {
|
||||
const temp = e?.replace(valid.valid_number, "");
|
||||
|
@ -90,10 +92,9 @@ const handleInput = (e: any, item: any) => {
|
|||
}
|
||||
};
|
||||
const model1 = reactive<any>({
|
||||
formData: {
|
||||
},
|
||||
formData: {},
|
||||
});
|
||||
const rules = ref({
|
||||
const rules1 = ref({
|
||||
"formData.userName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
|
@ -107,6 +108,14 @@ const rules = ref({
|
|||
trigger: ["blur", "change"],
|
||||
},
|
||||
});
|
||||
const rules2 = ref({
|
||||
"formData.userName": {
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入账号",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
});
|
||||
const contrlModalParams = reactive<any>({
|
||||
role: {
|
||||
isShow: false,
|
||||
|
@ -129,7 +138,7 @@ const contrlModalParams = reactive<any>({
|
|||
},
|
||||
});
|
||||
|
||||
const formAttrList = reactive<any>([
|
||||
const formAttrList1 = reactive<any>([
|
||||
{
|
||||
name: "姓名",
|
||||
key: "name",
|
||||
|
@ -174,6 +183,45 @@ const formAttrList = reactive<any>([
|
|||
},
|
||||
]);
|
||||
|
||||
const formAttrList2 = reactive<any>([
|
||||
{
|
||||
name: "姓名",
|
||||
key: "name",
|
||||
type: "input",
|
||||
},
|
||||
{
|
||||
name: "性别",
|
||||
key: "genderName",
|
||||
type: "select",
|
||||
childKey: "gender",
|
||||
fn: () => {
|
||||
contrlModalParams.gender.isShow = true;
|
||||
contrlModalParams.gender.title = "选择性别";
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "用户角色",
|
||||
key: "roleName",
|
||||
type: "select",
|
||||
childKey: "role",
|
||||
fn: () => {
|
||||
contrlModalParams.role.isShow = true;
|
||||
contrlModalParams.role.title = "选择角色";
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "账号",
|
||||
key: "userName",
|
||||
type: "input",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "联系手机",
|
||||
key: "phone",
|
||||
type: "input",
|
||||
},
|
||||
]);
|
||||
|
||||
const handleSelect = (key: string, v: any) => {
|
||||
contrlModalParams[key].isShow = false;
|
||||
if (key === "role") {
|
||||
|
@ -211,6 +259,7 @@ const save = () => {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (!model1.formData.id) {
|
||||
if (model1.formData.password) {
|
||||
if (!valid.valid_password.pattern.test(model1.formData.password)) {
|
||||
uni.showToast({
|
||||
|
@ -220,6 +269,8 @@ const save = () => {
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check().then((res) => {
|
||||
if (res) {
|
||||
startSave();
|
||||
|
@ -229,15 +280,22 @@ const save = () => {
|
|||
|
||||
const startSave = () => {
|
||||
if (model1.formData.id) {
|
||||
ProfileApi.updateUserById(model1.formData).then((res) => {
|
||||
ProfileApi.updateUserById({
|
||||
name: model1.formData.name,
|
||||
id: model1.formData.id,
|
||||
roleIds: model1.formData.roleIds,
|
||||
userName: model1.formData.userName,
|
||||
phone: model1.formData.phone,
|
||||
gender: model1.formData.gender,
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.navigateBack()
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ProfileApi.addUser({ userType: 1, ...model1.formData }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.navigateBack()
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -261,11 +319,11 @@ onMounted(() => {
|
|||
onLoad((option) => {
|
||||
// 接收传递的标题参数;
|
||||
const title = (option as any).title;
|
||||
const obj = JSON.parse((option as any).item)
|
||||
model1.formData = {...obj, genderName: ['未知','男','女'][obj.gender]};
|
||||
const obj = JSON.parse((option as any).item);
|
||||
model1.formData = { ...obj, genderName: ["未知", "男", "女"][obj.gender] };
|
||||
if (obj.roleVos.length > 0) {
|
||||
model1.formData.roleIds = [obj.roleVos[0].id]
|
||||
model1.formData.roleName = obj.roleVos[0].roleName
|
||||
model1.formData.roleIds = [obj.roleVos[0].id];
|
||||
model1.formData.roleName = obj.roleVos[0].roleName;
|
||||
}
|
||||
// 设置页面标题;
|
||||
if (title) {
|
||||
|
|
|
@ -91,7 +91,7 @@ const add = () => {
|
|||
const edit = (item: any) => {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
"/pagesApp/components/addRole?title=新增角色&item=" +
|
||||
"/pagesApp/components/addRole?title=编辑角色&item=" +
|
||||
JSON.stringify(item), // 要跳转到的页面路径
|
||||
});
|
||||
};
|
||||
|
|
|
@ -109,7 +109,7 @@ const update = (item: any) => {
|
|||
const edit = (item: any) => {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
"/pagesApp/components/addShipmentProduct?title=编辑收货产品&item=" +
|
||||
"/pagesApp/components/addShipmentProduct?title=编辑出货产品&item=" +
|
||||
JSON.stringify(item), // 要跳转到的页面路径
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="baseinfo">
|
||||
<view class="box">
|
||||
<view> 用户名: {{ profile.userName }} </view>
|
||||
<view> 姓名: {{ profile.userName }} </view>
|
||||
<view> 手机号码: {{ profile.phone }} </view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
<text class="address">{{ item.deviceName || "-" }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="number"
|
||||
>收货单号:{{ item.receiptNumber }}</text
|
||||
>
|
||||
<text class="number">收货单号:{{ item.receiptNumber }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="name">{{ item.userName }}</text>
|
||||
|
@ -42,7 +40,11 @@
|
|||
</view>
|
||||
<view class="flex-box">
|
||||
<text>毛重:{{ item.grossWeight }}kg</text>
|
||||
<text>单价:{{ state.scaleStatus === 0 ? '未定价' : item.price + '元/KG'}}</text>
|
||||
<text
|
||||
>单价:{{
|
||||
state.scaleStatus === 0 ? "未定价" : item.price + "元/KG"
|
||||
}}</text
|
||||
>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<u-button
|
||||
|
@ -85,9 +87,16 @@ const pageList: PageResult<Order> = reactive({
|
|||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const resetPageList = () => {
|
||||
pageList.noMoreData = false;
|
||||
pageList.total = 0;
|
||||
pageList.list = [];
|
||||
pageList.pageNum = 1;
|
||||
pageList.pageSize = 10;
|
||||
};
|
||||
const state = reactive({
|
||||
scaleStatus: 0
|
||||
})
|
||||
scaleStatus: 0,
|
||||
});
|
||||
const isShowCancelModal = ref(false);
|
||||
const deleteId = ref(0);
|
||||
const handleModal = (v: boolean, id: number) => {
|
||||
|
@ -100,9 +109,20 @@ const handleScenePhoto = (imagesId: number) => {
|
|||
});
|
||||
};
|
||||
const pricingDetail = (id: number) => {
|
||||
// 待过皮的时候 编辑前先查询当前状态 若是待过皮,则可继续编辑 否则提示该数据已处理 刷新当前页面
|
||||
ReceiveApi.getDetailById({ id: id }).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
if (res.data.scaleStatus > 1) {
|
||||
uni.showToast({title : '当前订单已处理'});
|
||||
resetPageList();
|
||||
getList();
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: "/pagesReceive/form/pricingForm?id=" + id, // 要跳转到的页面路径
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const getList = (v?: boolean) => {
|
||||
|
@ -146,11 +166,11 @@ onLoad((option) => {
|
|||
// 设置页面标题
|
||||
if (state.scaleStatus === ScaleStatus.ToBePriced) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '待定价',
|
||||
title: "待定价",
|
||||
});
|
||||
} else if (state.scaleStatus === ScaleStatus.ToBeTare) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '待过皮重',
|
||||
title: "待过皮重",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<text class="btn" @click="handleScenePhoto((item.imagesId as number))"
|
||||
<text class="btn" @click="handleScenePhoto(item.imagesId as number)"
|
||||
>现场照片</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<text class="desc">过磅时间:{{ item.grossTime || '-' }}</text>
|
||||
<text class="desc">过磅时间:{{ item.grossTime || "-" }}</text>
|
||||
</view>
|
||||
<view class="flex-box">
|
||||
<text>皮重:{{ item.tare }}kg</text>
|
||||
|
@ -29,12 +29,12 @@
|
|||
text="点击作废"
|
||||
color="#E8E8E8"
|
||||
:customStyle="{ color: '#999' }"
|
||||
@click="handleModal(true, (item.id as any))"
|
||||
@click="handleModal(true, item.id as any)"
|
||||
></u-button>
|
||||
<u-button
|
||||
type="primary"
|
||||
text="点击编辑"
|
||||
@click="pricingDetail((item.id as any))"
|
||||
@click="pricingDetail(item.id as any)"
|
||||
></u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -53,18 +53,20 @@
|
|||
import { ShipmentApi } from "@/services/index";
|
||||
import SmallModal from "@/components/Modal/smallModal.vue";
|
||||
|
||||
interface PageResult<T> {
|
||||
total: number;
|
||||
list: T[];
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
}
|
||||
const pageList: PageResult<Shipment> = reactive({
|
||||
const pageList: PageResult<Order> = reactive({
|
||||
noMoreData: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const resetPageList = () => {
|
||||
pageList.noMoreData = false;
|
||||
pageList.total = 0;
|
||||
pageList.list = [];
|
||||
pageList.pageNum = 1;
|
||||
pageList.pageSize = 10;
|
||||
};
|
||||
const isShowCancelModal = ref(false);
|
||||
const deleteId = ref(0);
|
||||
const handleModal = (v: boolean, id: number) => {
|
||||
|
@ -77,14 +79,43 @@ const handleScenePhoto = (imagesId: number) => {
|
|||
});
|
||||
};
|
||||
const pricingDetail = (id: string) => {
|
||||
// 待过皮的时候 编辑前先查询当前状态 若是待过皮,则可继续编辑 否则提示该数据已处理 刷新当前页面
|
||||
debugger
|
||||
ShipmentApi.getDetailById({ id: id }).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
if (res.data.scaleStatus > 1) {
|
||||
uni.showToast({ title: "当前订单已处理" });
|
||||
resetPageList();
|
||||
getList();
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: "/pagesShipment/form/shipmentForm?id=" + id, // 要跳转到的页面路径
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const getOrderList = () => {
|
||||
ShipmentApi.getOrderPage({ pageNumber: 1, pageSize: 10, scaleStatus: 1 }).then((res) => {
|
||||
|
||||
const getList = (v?: boolean) => {
|
||||
if (v) {
|
||||
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
|
||||
pageList.pageNum++;
|
||||
} else {
|
||||
pageList.noMoreData = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
let params: any = {
|
||||
pageSize: pageList.pageSize,
|
||||
pageNumber: pageList.pageNum,
|
||||
scaleStatus: 1,
|
||||
};
|
||||
pageList.isLoading = true;
|
||||
ShipmentApi.getOrderPage(params).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
(pageList as any).list = res.data.list;
|
||||
pageList.isLoading = false;
|
||||
(pageList as any).list = pageList.list.concat(res.data.list);
|
||||
pageList.total = (res.data as any).total;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -92,13 +123,13 @@ const handleOk = () => {
|
|||
console.log(deleteId.value);
|
||||
ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
getOrderList();
|
||||
getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getOrderList();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -253,6 +253,7 @@ const getList = (v?: boolean) => {
|
|||
});
|
||||
};
|
||||
onShow(() => {
|
||||
resetPageList()
|
||||
getList();
|
||||
});
|
||||
onLoad((option) => {
|
||||
|
|
|
@ -102,9 +102,21 @@ const handleScenePhoto = (id: any) => {
|
|||
});
|
||||
};
|
||||
const pricingDetail = (id: string) => {
|
||||
console.log(state.scaleStatus)
|
||||
ShipmentApi.getDetailById({ id: id }).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
if (res.data.scaleStatus > 1) {
|
||||
uni.showToast({ title: "当前订单已处理" });
|
||||
resetPageList();
|
||||
getList();
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: "/pagesShipment/form/shipmentForm?id=" + id + `&scaleStatus=${state.scaleStatus}`, // 要跳转到的页面路径
|
||||
url:
|
||||
"/pagesShipment/form/shipmentForm?id=" +
|
||||
id +
|
||||
`&scaleStatus=${state.scaleStatus}`, // 要跳转到的页面路径
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const getList = (v?: boolean) => {
|
||||
|
@ -124,9 +136,7 @@ const getList = (v?: boolean) => {
|
|||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
pageList.isLoading = false;
|
||||
(pageList as any).list = (
|
||||
pageList as any
|
||||
).list.concat(res.data.list);
|
||||
(pageList as any).list = (pageList as any).list.concat(res.data.list);
|
||||
pageList.total = (res.data as any).total;
|
||||
}
|
||||
});
|
||||
|
@ -146,19 +156,19 @@ onShow(() => {
|
|||
});
|
||||
|
||||
const state = reactive({
|
||||
scaleStatus: 0
|
||||
})
|
||||
scaleStatus: 0,
|
||||
});
|
||||
onLoad((option) => {
|
||||
// 接收传递的标题参数
|
||||
state.scaleStatus = parseInt((option as any).scaleStatus);
|
||||
// 设置页面标题
|
||||
if (state.scaleStatus === ScaleStatus.ToBeShipment) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '待出货',
|
||||
title: "待出货",
|
||||
});
|
||||
} else if (state.scaleStatus === ScaleStatus.ToBeGrossWeight) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '待过毛重',
|
||||
title: "待过毛重",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue