123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543 |
- <template>
- <div>
- <el-card :class="props.selectStatus ? 'select-card' : 'box-card'">
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- :searchConfig="searchConfig"
- highlight-current-row
- :action-list="[
- props.selectStatus
- ? {}
- : {
- text: '操作日志',
- action: () => viewLogs(),
- },
- ]"
- @get-list="getList"
- @clickReset="clickReset">
- <template #code="{ item }">
- <div>
- <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
- </div>
- </template>
- <template #totalAmount="{ item }">
- <div style="color: #409eff">{{ moneyFormat(item.totalAmount) }}</div>
- </template>
- <template #address="{ item }">
- <div>{{ item.province }}, {{ item.city }}, {{ item.county }}, {{ item.detailedAddress }}</div>
- </template>
- </byTable>
- </el-card>
- <el-dialog title="操作日志" v-if="openLogs" v-model="openLogs" width="50%">
- <byTable
- :source="logsList.data"
- :pagination="logsList.pagination"
- :config="configLogs"
- :loading="loadingLogs"
- highlight-current-row
- @get-list="getLogsList">
- </byTable>
- <template #footer>
- <el-button @click="openLogs = false" size="large">关 闭</el-button>
- </template>
- </el-dialog>
- <el-dialog title="修改税率" v-if="openChangeTaxRate" v-model="openChangeTaxRate" width="500">
- <el-form :model="details.data" label-width="120px" ref="taxRate">
- <el-form-item label="税率" prop="taxRate" :rules="[{ required: true, message: '请输入税率', trigger: 'blur' }]">
- <el-input-number
- onmousewheel="return false;"
- v-model="details.data.taxRate"
- placeholder="请输入税率"
- style="width: 100%"
- :controls="false"
- :min="0"
- :precision="2"
- :max="100" />
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button @click="openChangeTaxRate = false" size="large">取 消</el-button>
- <el-button type="primary" @click="submitChangeTaxRate()" size="large" v-preReClick>确 定</el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import byTable from "/src/components/byTable/index";
- import { ElMessage, ElMessageBox } from "element-plus";
- const { proxy } = getCurrentInstance();
- const props = defineProps({
- selectStatus: Boolean,
- departmentId: String,
- });
- const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- departmentId: "",
- code: "",
- wlnCode: "",
- status: "",
- settlementStatus: "",
- exception: "0",
- },
- });
- const loading = ref(false);
- const searchConfig = computed(() => {
- return [
- {
- type: "input",
- prop: "code",
- label: "订单号",
- },
- {
- type: "input",
- prop: "wlnCode",
- label: "万里牛单号",
- },
- props.departmentId
- ? {}
- : {
- type: "select",
- prop: "departmentId",
- data: departmentList.value,
- label: "事业部",
- },
- props.departmentId
- ? {}
- : {
- type: "select",
- prop: "status",
- dictKey: "order_status",
- label: "订单状态",
- },
- {
- type: "select",
- prop: "settlementStatus",
- label: "结算状态",
- data: proxy.useUserStore().allDict["settlement_status"],
- },
- ];
- });
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "事业部",
- prop: "departmentName",
- width: 120,
- },
- },
- {
- attrs: {
- label: "订单号",
- slot: "code",
- width: 200,
- },
- },
- {
- attrs: {
- label: "万里牛单号",
- prop: "wlnCode",
- width: 160,
- },
- },
- {
- attrs: {
- label: "快递单号",
- prop: "expressDeliveryCode",
- width: 140,
- },
- },
- {
- attrs: {
- label: "订单状态",
- prop: "status",
- width: 120,
- },
- render(val) {
- return proxy.dictKeyValue(val, proxy.useUserStore().allDict["order_status"]);
- },
- },
- {
- attrs: {
- label: "结算状态",
- prop: "settlementStatus",
- width: 120,
- },
- render(val) {
- return proxy.dictKeyValue(val, proxy.useUserStore().allDict["settlement_status"]);
- },
- },
- {
- attrs: {
- label: "税率",
- prop: "taxRate",
- width: 80,
- },
- render(val) {
- return val + "%";
- },
- },
- {
- attrs: {
- label: "订单总金额 ¥",
- slot: "totalAmount",
- width: 120,
- align: "right",
- },
- },
- {
- attrs: {
- label: "产品总金额 ¥",
- prop: "productTotalAmount",
- width: 120,
- align: "right",
- },
- render(val) {
- return proxy.moneyFormat(val);
- },
- },
- {
- attrs: {
- label: "定制加工费 ¥",
- prop: "customProcessingFee",
- width: 120,
- align: "right",
- },
- render(val) {
- return proxy.moneyFormat(val);
- },
- },
- {
- attrs: {
- label: "代发费 ¥",
- prop: "lssueFee",
- width: 120,
- align: "right",
- },
- render(val) {
- return proxy.moneyFormat(val);
- },
- },
- {
- attrs: {
- label: "快递包材费 ¥",
- prop: "deliveryMaterialsFee",
- width: 120,
- align: "right",
- },
- render(val) {
- return proxy.moneyFormat(val);
- },
- },
- {
- attrs: {
- label: "包装人工费 ¥",
- prop: "packingLabor",
- width: 120,
- align: "right",
- },
- render(val) {
- return proxy.moneyFormat(val);
- },
- },
- {
- attrs: {
- label: "包材费 ¥",
- prop: "packagingMaterialCost",
- width: 120,
- align: "right",
- },
- render(val) {
- return proxy.moneyFormat(val);
- },
- },
- {
- attrs: {
- label: "管理费 ¥",
- prop: "managementFee",
- width: 120,
- align: "right",
- },
- render(val) {
- return proxy.moneyFormat(val);
- },
- },
- {
- attrs: {
- label: "交期",
- prop: "deliveryTime",
- width: 160,
- align: "center",
- },
- },
- {
- attrs: {
- label: "发货时间",
- prop: "shippingTime",
- width: 160,
- align: "center",
- },
- },
- {
- attrs: {
- label: "收货人",
- prop: "consignee",
- width: 140,
- },
- },
- {
- attrs: {
- label: "收货人电话",
- prop: "consigneeNumber",
- width: 140,
- },
- },
- {
- attrs: {
- label: "收货人地址",
- slot: "address",
- width: 220,
- },
- },
- {
- attrs: {
- label: "操作",
- width: 120,
- align: "center",
- fixed: "right",
- },
- renderHTML(row) {
- return [
- props.selectStatus
- ? {
- attrs: {
- label: "选择",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickSelect(row);
- },
- }
- : {
- attrs: {
- label: "税率",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickChangeTaxRate(row);
- },
- },
- (row.status == 0 || row.status == 10 || row.status == 20) && !props.selectStatus
- ? {
- attrs: {
- label: "删除",
- type: "danger",
- text: true,
- },
- el: "button",
- click() {
- clickDelete(row);
- },
- }
- : {},
- ];
- },
- },
- ];
- });
- const getDemandData = () => {
- proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- if (res.rows && res.rows.length > 0) {
- departmentList.value = departmentList.value.concat(
- res.rows.map((item) => {
- return {
- dictKey: item.id,
- dictValue: item.name,
- };
- })
- );
- }
- });
- };
- getDemandData();
- const getList = async (req, status) => {
- if (status) {
- sourceList.value.pagination = {
- pageNum: sourceList.value.pagination.pageNum,
- pageSize: sourceList.value.pagination.pageSize,
- };
- } else {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- }
- if (props.selectStatus) {
- sourceList.value.pagination.linkedStatementOfAccount = 0;
- }
- if (props.departmentId) {
- sourceList.value.pagination.departmentId = props.departmentId;
- }
- loading.value = true;
- proxy.post("/orderInfo/page", sourceList.value.pagination).then((res) => {
- sourceList.value.data = res.rows;
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- getList();
- const clickReset = () => {
- getList("", true);
- };
- const clickCode = (row) => {
- proxy.$router.replace({
- path: "/order-detail",
- query: {
- detailId: row.id,
- text: "订单详情",
- random: proxy.random(),
- },
- });
- };
- const clickDelete = (row) => {
- ElMessageBox.confirm("你是否确认此操作", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- proxy.post("/orderInfo/delete", { id: row.id }).then(() => {
- ElMessage({ message: "删除成功", type: "success" });
- getList();
- });
- })
- .catch(() => {});
- };
- const openLogs = ref(false);
- const loadingLogs = ref(false);
- const logsList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- },
- });
- const type = ref([
- { dictKey: "10", dictValue: "新增订单" },
- { dictKey: "20", dictValue: "图稿上传" },
- { dictKey: "21", dictValue: "修改税率" },
- { dictKey: "30", dictValue: "删除订单" },
- ]);
- const configLogs = computed(() => {
- return [
- {
- attrs: {
- label: "操作时间",
- prop: "createTime",
- width: 160,
- align: "center",
- },
- },
- {
- attrs: {
- label: "操作人",
- prop: "userName",
- align: "center",
- },
- },
- {
- attrs: {
- label: "订单号",
- prop: "orderCode",
- align: "center",
- },
- },
- {
- attrs: {
- label: "行为",
- prop: "type",
- width: 100,
- align: "center",
- },
- render(val) {
- return proxy.dictKeyValue(val, type.value);
- },
- },
- ];
- });
- const viewLogs = () => {
- logsList.value.data = [];
- logsList.value.pagination.total = 0;
- openLogs.value = true;
- getLogsList({ pageNum: 1, pageSize: 10 });
- };
- const getLogsList = async (req) => {
- logsList.value.pagination = { ...logsList.value.pagination, ...req };
- loadingLogs.value = true;
- proxy.post("/orderOperatingLog/page", logsList.value.pagination).then((res) => {
- logsList.value.data = res.rows;
- logsList.value.pagination.total = res.total;
- setTimeout(() => {
- loadingLogs.value = false;
- }, 200);
- });
- };
- const details = reactive({
- data: {},
- });
- const openChangeTaxRate = ref(false);
- const clickChangeTaxRate = (item) => {
- proxy.post("/orderInfo/detail", { id: item.id }).then((res) => {
- details.data = res;
- openChangeTaxRate.value = true;
- });
- };
- const submitChangeTaxRate = () => {
- proxy.$refs.taxRate.validate((valid) => {
- if (valid) {
- details.data.updateType = "21";
- proxy.post("/orderInfo/edit", details.data).then(() => {
- ElMessage({ message: "修改完成", type: "success" });
- openChangeTaxRate.value = false;
- getList();
- });
- }
- });
- };
- const emit = defineEmits(["selectOrder"]);
- const clickSelect = (item) => {
- emit("selectOrder", item);
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep(.el-input-number .el-input__inner) {
- text-align: left;
- }
- :deep(.el-dialog) {
- margin-top: 10px !important;
- margin-bottom: 10px !important;
- }
- .select-card {
- height: calc(100vh - 184px);
- overflow-y: auto;
- overflow-x: hidden;
- }
- </style>
|