1018653686@qq.com 1 рік тому
батько
коміт
61f2451301

+ 19 - 2
public/callback.html

@@ -7,7 +7,7 @@
 </head>
 <style>
   body{
-    background-size:cover;
+    background-size: cover;
     background: url(img/loading.gif) no-repeat fixed center top;
   }
 </style>
@@ -19,8 +19,25 @@
     // 向父级页面发送消息
     window.parent.postMessage('closeIframe', '*');
   }
-  var timer = setInterval(notifyParentAndClose, 3000); // 1000 毫秒等于 1 秒
+  // var timer = setInterval(notifyParentAndClose, 3000); // 1000 毫秒等于 1 秒
 
+  function getParameterByName(name, url) {
+    if (!url) url = window.location.href;
+    name = name.replace(/[\[\]]/g, "\\$&");
+    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
+            results = regex.exec(url);
+    if (!results) return null;
+    if (!results[2]) return '';
+    return decodeURIComponent(results[2].replace(/\+/g, " "));
+  }
+
+  // 使用示例
+  const parameterValue = getParameterByName('msg');
+  if(parameterValue == '' || parameterValue == undefined || parameterValue == 'undefined'){
+    setInterval(notifyParentAndClose, 3000);
+  }else{
+    window.parent.postMessage('alertAndCloseIframe#'+encodeURIComponent(parameterValue), '*')
+  }
 </script>
 </body>
 </html>

+ 8 - 0
src/components/jdStatus/index.vue

@@ -14,6 +14,7 @@
 <script setup>
 
 import {watch} from "@vue/runtime-core";
+import { ElMessage, ElMessageBox } from "element-plus";
 
 const { proxy } = getCurrentInstance();
 const iframeSrc = ref('');
@@ -35,6 +36,8 @@ const loading = ref(false);
 window.addEventListener('message', function(event) {
   if (event.data === 'closeIframe') {
     closeIframe();
+  }else if (event.data.indexOf('alertAndCloseIframe')>=0){
+    alertAndCloseIframe(decodeURIComponent(event.data.split('#')[1]));
   }
 });
 
@@ -60,6 +63,11 @@ function closeIframe() {
   closeNoticeTableModal();
 }
 
+function alertAndCloseIframe(msg) {
+  closeNoticeTableModal();
+  ElMessageBox.alert(msg)
+}
+
 </script>
 <style lang="scss">
 iframe {

+ 314 - 0
src/views/WDLY/jd/backOrder/index.vue

@@ -0,0 +1,314 @@
+<template>
+    <div class="tenant">
+        <byTable
+                :source="sourceList.data"
+                :pagination="sourceList.pagination"
+                :config="config"
+                :loading="loading"
+                highlight-current-row
+                :selectConfig="selectConfig"
+                :table-events="{
+                    select: select,
+                }"
+                :action-list="[]"
+                @get-list="getList">
+        </byTable>
+
+        <el-dialog z-index="1100" title="退货单详情" v-if="dialogVisible" v-model="dialogVisible" width="800px" v-loading="loading">
+            <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
+
+            </byForm>
+            <template #footer>
+                <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+                <el-button type="primary" v-if="formData.data.businessStatus == 1" @click="submitForm" size="large" :loading="submitLoading">确 定</el-button>
+            </template>
+        </el-dialog>
+    </div>
+</template>
+
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import {computed, nextTick, reactive, ref} from "vue";
+const { proxy } = getCurrentInstance();
+
+const router = useRouter();
+const loading = ref(false);
+const blessingTypeList = ref([]);
+const submitLoading = ref(false);
+const sourceList = ref({
+    data: [],
+    pagination: {
+        total: 0,
+        pageNum: 1,
+        pageSize: 10,
+    },
+});
+
+let rules = ref({
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+const selectConfig = computed(() => {
+    return [
+        {
+            label: "订单状态",
+            prop: "blessingType",
+            data: blessingTypeList.value
+        },
+    ]});
+
+const config = computed(() => {
+    return [
+
+        {
+            attrs: {
+                label: "退货单号",
+                prop: "returnId",
+                align: "center"
+            }
+        },
+        {
+            attrs: {
+                label: "创建日期",
+                prop: "createDate",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "供应商名称",
+                prop: "providerName",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "退货地配送中心名称",
+                prop: "fromDeliverCenterName",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "目的地配送中心名称",
+                prop: "toDeliverCenterName",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "退货总数量",
+                prop: "totalNum",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "退货总金额",
+                prop: "totalPrice",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "退货单出库时间",
+                prop: "outStoreRoomDate",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "退货单品种数",
+                prop: "wareVariety",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "是否确认",
+                prop: "businessStatus",
+                align: "center",
+            },
+            render(value) {
+                return value == '1' ? "已确认" : "未确认";
+            },
+        },
+        {
+            attrs: {
+                label: "操作",
+                width: "300",
+                align: "right",
+            },
+            renderHTML(row) {
+                return [
+                    {
+                        attrs: {
+                            label: "详情",
+                            type: "primary",
+                            text: true,
+                        },
+                        el: "button",
+                        click() {
+                            getDtl(row);
+                        },
+                    },
+                    row.businessStatus!=0?
+                        {
+                            attrs: {
+                                label: "退货单确认",
+                                type: "danger",
+                                text: true,
+                            },
+                            el: "button",
+                            click() {
+                                ElMessageBox.confirm("是否确认当前退货单?", "提示", {
+                                    confirmButtonText: "确定",
+                                    cancelButtonText: "取消",
+                                    type: "warning",
+                                }).then(() => {
+                                    confirmBusinessStatus(row);
+                                });
+                            },
+                        }
+                        :{},
+                ];
+            },
+        },
+    ];
+});
+
+let formData = reactive({
+    data: {
+        coverList:[],
+        audioList:[],
+    },
+});
+const formOption = reactive({
+    inline: true,
+    labelWidth: 100,
+    itemWidth: 100,
+    rules: [],
+});
+const byform = ref(null);
+
+const formConfig = computed(() => {
+    return [
+        {
+            type: "input",
+            prop: "orderId",
+            label: "京东订单号",
+            readonly: true
+        },
+        {
+            type: "input",
+            prop: "createdDate",
+            label: "订购时间",
+            readonly: true
+        },
+        {
+            type: "input",
+            label: "采购单明细,应该是个一对多还没弄",
+            readonly: true
+        },
+    ];
+});
+
+const getDictlist = async () => {
+    // proxy
+    //     .getDictOne([
+    //         "blessing_type"
+    //     ])
+    //     .then((res) => {
+    //         blessingTypeList.value = res["blessing_type"].map((x) => ({
+    //             label: x.dictValue,
+    //             value: x.dictKey,
+    //         }));
+    //     });
+};
+
+const getList = async (req) => {
+    sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+    loading.value = true;
+    proxy.post("/jdBack/page", sourceList.value.pagination).then((res) => {
+        sourceList.value.data = res.rows;
+        sourceList.value.pagination.total = res.total;
+        setTimeout(() => {
+            loading.value = false;
+        }, 200);
+    });
+};
+
+const openModal = () => {
+    dialogVisible.value = true;
+    modalType.value = "add";
+    formData.data = {
+        content:'',
+    };
+};
+const selection = ref({
+    data: [],
+});
+const select = (_selection, row) => {
+    selection.value.data = _selection;
+};
+
+const getDtl = (row) => {
+    modalType.value = "edit";
+    proxy.post("/jdBack/detail", { id: row.id }).then((res) => {
+        formData.data = res;
+        dialogVisible.value = true;
+    });
+};
+
+
+const confirmBusinessStatus = (row) => {
+    let businessStatus = row.businessStatus=='1' ? 0 : 1;
+
+    proxy.post("/jdBack/confirmBusinessStatus", { id: row.id, businessStatus: businessStatus }).then(
+        () => {
+            ElMessage({
+                message: "确认成功",
+                type: "success",
+            });
+            dialogVisible.value = false;
+            submitLoading.value = false;
+            getList();
+        },
+        (err) => {
+            console.log(err);
+            submitLoading.value = false;
+        }
+    );
+}
+
+const submitForm = () => {
+    byform.value.handleSubmit(() => {
+        submitLoading.value = true;
+        //TODO 这里应该是订单回告
+        proxy.post("/jdOrder/" + modalType.value, formData.data).then(
+            () => {
+                ElMessage({
+                    message: modalType.value == "add" ? "添加成功" : "编辑成功",
+                    type: "success",
+                });
+                dialogVisible.value = false;
+                submitLoading.value = false;
+                getList();
+            },
+            (err) => {
+                console.log(err);
+                submitLoading.value = false;
+            }
+        );
+    });
+};
+
+
+getDictlist()
+getList()
+</script>
+
+<style lang='scss' scoped>
+</style>

+ 307 - 0
src/views/WDLY/jd/order/index.vue

@@ -0,0 +1,307 @@
+<template>
+    <div class="tenant">
+        <byTable
+                :source="sourceList.data"
+                :pagination="sourceList.pagination"
+                :config="config"
+                :loading="loading"
+                highlight-current-row
+                :selectConfig="selectConfig"
+                :table-events="{
+                    select: select,
+                }"
+                :action-list="[]"
+                @get-list="getList">
+        </byTable>
+
+        <el-dialog z-index="1100" title="采购单详情" v-if="dialogVisible" v-model="dialogVisible" width="800px" v-loading="loading">
+            <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
+
+            </byForm>
+            <template #footer>
+                <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+                <el-button type="primary" v-if="formData.data.businessStatus == 1" @click="submitForm" size="large" :loading="submitLoading">确 定</el-button>
+            </template>
+        </el-dialog>
+    </div>
+</template>
+
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import {computed, nextTick, reactive, ref} from "vue";
+const { proxy } = getCurrentInstance();
+
+const router = useRouter();
+const loading = ref(false);
+const blessingTypeList = ref([]);
+const submitLoading = ref(false);
+const sourceList = ref({
+    data: [],
+    pagination: {
+        total: 0,
+        pageNum: 1,
+        pageSize: 10,
+    },
+});
+
+let rules = ref({
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+const selectConfig = computed(() => {
+    return [
+        {
+            label: "订单状态",
+            prop: "blessingType",
+            data: blessingTypeList.value
+        },
+    ]});
+
+const config = computed(() => {
+    return [
+
+        {
+            attrs: {
+                label: "京东订单号",
+                prop: "orderId",
+                align: "center"
+            }
+        },
+        {
+            attrs: {
+                label: "订购时间",
+                prop: "createdDate",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "供应商名称",
+                prop: "providerName",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "采购总金额",
+                prop: "totalPrice",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "配送中心名称",
+                prop: "deliverCenterName",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "订单状态",
+                prop: "stateName",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "详细地址",
+                prop: "address",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "采购类型",
+                prop: "orderTypeName",
+                align: "center"
+            },
+        },
+        {
+            attrs: {
+                label: "是否确认",
+                prop: "businessStatus",
+                align: "center",
+            },
+            render(value) {
+                return value == '1' ? "已确认" : "未确认";
+            },
+        },
+        {
+            attrs: {
+                label: "操作",
+                width: "300",
+                align: "right",
+            },
+            renderHTML(row) {
+                return [
+                    {
+                        attrs: {
+                            label: "详情",
+                            type: "primary",
+                            text: true,
+                        },
+                        el: "button",
+                        click() {
+                            getDtl(row);
+                        },
+                    },
+                    row.businessStatus==0?
+                        {
+                            attrs: {
+                                label: "采购单确认",
+                                type: "danger",
+                                text: true,
+                            },
+                            el: "button",
+                            click() {
+                                ElMessageBox.confirm("是否确认当前采购单?", "提示", {
+                                    confirmButtonText: "确定",
+                                    cancelButtonText: "取消",
+                                    type: "warning",
+                                }).then(() => {
+                                    confirmBusinessStatus(row);
+                                });
+                            },
+                        }
+                        :{},
+                ];
+            },
+        },
+    ];
+});
+
+let formData = reactive({
+    data: {
+        coverList:[],
+        audioList:[],
+    },
+});
+const formOption = reactive({
+    inline: true,
+    labelWidth: 100,
+    itemWidth: 100,
+    rules: [],
+});
+const byform = ref(null);
+
+const formConfig = computed(() => {
+    return [
+        {
+            type: "input",
+            prop: "orderId",
+            label: "京东订单号",
+            readonly: true
+        },
+        {
+            type: "input",
+            prop: "createdDate",
+            label: "订购时间",
+            readonly: true
+        },
+        {
+            type: "input",
+            label: "采购单明细,应该是个一对多还没弄",
+            readonly: true
+        },
+    ];
+});
+
+const getDictlist = async () => {
+    // proxy
+    //     .getDictOne([
+    //         "blessing_type"
+    //     ])
+    //     .then((res) => {
+    //         blessingTypeList.value = res["blessing_type"].map((x) => ({
+    //             label: x.dictValue,
+    //             value: x.dictKey,
+    //         }));
+    //     });
+};
+
+const getList = async (req) => {
+    sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+    loading.value = true;
+    proxy.post("/jdOrder/page", sourceList.value.pagination).then((res) => {
+        sourceList.value.data = res.rows;
+        sourceList.value.pagination.total = res.total;
+        setTimeout(() => {
+            loading.value = false;
+        }, 200);
+    });
+};
+
+const openModal = () => {
+    dialogVisible.value = true;
+    modalType.value = "add";
+    formData.data = {
+        content:'',
+    };
+};
+const selection = ref({
+    data: [],
+});
+const select = (_selection, row) => {
+    selection.value.data = _selection;
+};
+
+const getDtl = (row) => {
+    modalType.value = "edit";
+    proxy.post("/jdOrder/detail", { id: row.id }).then((res) => {
+        formData.data = res;
+        dialogVisible.value = true;
+    });
+};
+
+
+const confirmBusinessStatus = (row) => {
+    let businessStatus = row.businessStatus=='1' ? 0 : 1;
+
+    proxy.post("/jdOrder/confirmBusinessStatus", { id: row.id, businessStatus: businessStatus }).then(
+        () => {
+            ElMessage({
+                message: "确认成功",
+                type: "success",
+            });
+            dialogVisible.value = false;
+            submitLoading.value = false;
+            getList();
+        },
+        (err) => {
+            console.log(err);
+            submitLoading.value = false;
+        }
+    );
+}
+
+const submitForm = () => {
+    byform.value.handleSubmit(() => {
+        submitLoading.value = true;
+        //TODO 这里应该是订单回告
+        proxy.post("/jdOrder/" + modalType.value, formData.data).then(
+            () => {
+                ElMessage({
+                    message: modalType.value == "add" ? "添加成功" : "编辑成功",
+                    type: "success",
+                });
+                dialogVisible.value = false;
+                submitLoading.value = false;
+                getList();
+            },
+            (err) => {
+                console.log(err);
+                submitLoading.value = false;
+            }
+        );
+    });
+};
+
+
+getDictlist()
+getList()
+</script>
+
+<style lang='scss' scoped>
+</style>