فهرست منبع

退款及发票修改

zuy 2 سال پیش
والد
کامیت
8c17ade836

+ 0 - 269
admin-web/src/components/attach/Attach.vue

@@ -1,269 +0,0 @@
-<style lang="scss" scoped>
-.attach-container-left {
-  display: flex;
-  flex-direction: column;
-  justify-items: flex-end;
-
-  img {
-    height: 45px;
-  }
-}
-
-.attach-container-left-line {
-  display: inline-flex;
-  flex-wrap: nowrap;
-
-  img {
-    height: 20px;
-  }
-}
-</style>
-<template>
-  <div class="attach-container">
-    <el-tooltip placement="top" effect="light">
-      <div :class="inline?'attach-container-left-line':'attach-container-left'">
-        <template v-if="state.isImage">
-          <img :src="u.fmt.fmtImg(state.uid)"/>
-        </template>
-        <template v-else><img :src="state.icon"/></template>
-
-        <el-button text size="small" :title="state.name" @click="handlePreview">{{ state.name }}</el-button>
-      </div>
-      <div class="attache-container-right">
-        <slot name="extraRight"></slot>
-      </div>
-      <template #content>
-        <el-button-group>
-          <el-button size="small" type="success" text v-if="downable&&!readonly" @click="handleDownload"> 下载</el-button>
-          <el-button size="small" type="danger" text v-if="!readonly" @click="handleDelete"> 删除</el-button>
-        </el-button-group>
-
-
-      </template>
-    </el-tooltip>
-    <Preview ref="previewRef" :url="state.previewUrl" :name="state.name"/>
-    <ExcelEditor ref="excelEditorRef" :url="state.previewUrl" :name="state.name" :uid="state.uid"/>
-  </div>
-</template>
-
-<!--统一文件展示组件、预览、编辑、删除管理-->
-<script setup lang="ts" name="Attach">
-import {reactive, onMounted, ref, onBeforeUnmount, defineAsyncComponent, computed} from 'vue';
-import u from "/@/utils/u";
-import {$get} from "/@/utils/request";
-import {Msg} from "/@/utils/message";
-
-
-const Preview = defineAsyncComponent(() => import("/@/components/preview/Preview.vue"));
-const ExcelEditor = defineAsyncComponent(() => import("/@/components/excel/ExcelEditor.vue"));
-// const Luckysheet = defineAsyncComponent(() => import("/@/components/excel/Luckysheet.vue"));
-
-// 定义父组件传过来的值
-const props = defineProps({
-  attach: {
-    type: Object,
-    default: () => {
-      return {
-        id: 0,
-        uid: '',
-        name: '',
-        size: 0,
-      }
-    }
-  },
-  readonly: {
-    type: Boolean,
-    default: false
-  },
-  editable: {
-    type: Boolean,
-    default: false
-  },
-  downable: {
-    type: Boolean,
-    default: false
-  },
-  deletable: {
-    type: Boolean,
-    default: false
-  },
-  inline: {
-    type: Boolean,
-    default: false
-  }
-})
-
-const edit = computed(() => {
-  if (props.editable && props.attach) {
-    props.attach.uid.toLowerCase().endsWith(".xlsx");
-  }
-  return false;
-});
-
-// const luckysheetRef = ref();
-const excelEditorRef = ref();
-const previewRef = ref();
-// 定义子组件向父组件传值/事件
-const emit = defineEmits(['on-preview', 'on-edit', 'on-download', 'on-delete']);
-
-import {preview} from 'vue3-image-preview'
-
-
-// 定义变量内容
-const state = reactive({
-  uid: '',
-  icon: '',
-  name: '',
-  content: '',
-  previewUrl: '',
-  isImage: false,
-  attachConf: [
-    {
-      suffix: ['jpg', 'jpeg', 'png', 'gif', 'svg'],
-      icon: '@/assets/mime/jpg.svg'
-    },
-    {
-      suffix: ["mp4", "ogg", "avi", "webm"],
-      icon: '@/assets/mime/video.svg'
-    },
-    {
-      suffix: ["mp3", "amr", "avi", "wav"],
-      icon: '@/assets/mime/audio.svg'
-    },
-    {
-      suffix: ["doc", "docx"],
-      icon: '@/assets/mime/docx.svg'
-    },
-    {
-      suffix: ["xls", "xlsx"],
-      icon: '@/assets/mime/xlsx.svg'
-    },
-    {
-      suffix: ["ppt", "pptx"],
-      icon: '@/assets/mime/pptx.svg'
-    },
-    {
-      suffix: ["pdf"],
-      icon: '@/assets/mime/pdf.svg'
-    },
-    {
-      suffix: ["txt", "log", "css"],
-      icon: '@/assets/mime/txt.svg'
-    },
-    {
-      suffix: ["zip", "rar", "7z", "gz", "xz", "tar"],
-      icon: '@/assets/mime/rar.svg'
-    },
-    {
-      suffix: ["html", "htm"],
-      icon: '@/assets/mime/web.svg'
-    },
-    {
-      suffix: ["java", "js", "php", "py", "sh", "bat"],
-      icon: '@/assets/mime/bat.svg'
-    },
-  ]
-});
-
-// 页面销毁时
-onBeforeUnmount(() => {
-});
-
-onMounted(() => {
-  init();
-})
-
-const init = () => {
-  console.log(props.attach)
-  let {name, size, id, uid} = props.attach;
-  if (name) {
-    state.name = name;
-  } else {
-    if (uid) {
-      state.name = uid;
-    }
-  }
-
-  if (!uid) {
-    throw new Error('文件不存在~');
-  }
-  state.uid = uid;
-//文件类型判断
-  let suffix = uid.substring(uid.lastIndexOf(".") + 1).toLowerCase();
-
-  let conf = state.attachConf.find(k => k.suffix.includes(suffix));
-  console.log(suffix, conf)
-  if (conf) {
-    state.icon = conf.icon;
-  } else {
-    state.icon = "@/assets/mime/other.svg"
-  }
-
-  if (state.attachConf[0].suffix.includes(suffix)) {
-    state.isImage = true;
-  }
-
-}
-
-const handlePreview = () => {
-  if (state.isImage) {
-    preview({images: u.fmt.fmtImg(state.uid)})
-  } else {
-    handleReady();
-    previewRef.value.handlePreview();
-  }
-
-  emit('on-preview', state.uid)
-}
-
-const handleReady = async () => {
-  //1.获取预览的key
-  try {
-    let key = await $get(`/preview/getKey/${state.uid}`);
-    //2.打开预览页面
-    state.previewUrl = `${u.url.preview}${key}`
-    console.log(state.previewUrl)
-  } catch (e) {
-    Msg.message(`文件地址错误,请稍后再试`, 'error')
-  }
-
-  // .then((res: any) => {
-  //    let key = res;
-  //    //2.打开预览页面
-  //    state.previewUrl = `${u.url.preview}${key}`
-  //    console.log(state.previewUrl)
-  //
-  //  }).catch((e) => {
-  //    console.error(e)
-  //    Msg.message(`文件地址错误,请稍后再试`,'error')
-  //  })
-}
-
-const handleDownload = () => {
-  let url = u.fmt.fmtUrl(state.uid)
-  window.open(url, '_blank')
-  emit('on-download', state.uid)
-}
-
-const handleEdit = async () => {
-  await handleReady();
-  let suffix = state.name.substring(state.name.lastIndexOf(".")).toLowerCase();
-  if (suffix.endsWith(".xlsx")) {
-    excelEditorRef.value.handleEdit();
-    // luckysheetRef.value.initLuckysheet()
-  } else {
-    Msg.message(`暂不支持该格式文件的在线编辑功能`)
-  }
-  emit('on-edit', state.uid)
-}
-
-const handleDelete = () => {
-  emit('on-delete', state.uid)
-}
-
-defineExpose({
-  handlePreview
-});
-
-
-</script>

+ 56 - 17
admin-web/src/views/admin/invoice/index.vue

@@ -128,17 +128,17 @@
                   <el-table :data="row.orderDetails" width="400" border>
                     <el-table-column label="充电订单" prop="startChargeSeq"/>
                     <el-table-column label="总金额(元)" prop="totalMoney">
-                      <template #default="{row}">{{u.fmt.fmtMoney(row.totalMoney)}}</template>
+                      <template #default="{row}">{{ u.fmt.fmtMoney(row.totalMoney) }}</template>
                     </el-table-column>
                     <el-table-column label="总电量(Kwh)" prop="totalPower"/>
                     <el-table-column label="电费" prop="elecMoney">
-                      <template #default="{row}">{{u.fmt.fmtMoney(row.elecMoney)}}</template>
+                      <template #default="{row}">{{ u.fmt.fmtMoney(row.elecMoney) }}</template>
                     </el-table-column>
                     <el-table-column label="服务费" prop="serviceMoney">
-                      <template #default="{row}">{{u.fmt.fmtMoney(row.serviceMoney)}}</template>
+                      <template #default="{row}">{{ u.fmt.fmtMoney(row.serviceMoney) }}</template>
                     </el-table-column>
                     <el-table-column label="服务费优惠" prop="serviceMoneyDiscount">
-                      <template #default="{row}">{{u.fmt.fmtMoney(row.serviceMoneyDiscount)}}</template>
+                      <template #default="{row}">{{ u.fmt.fmtMoney(row.serviceMoneyDiscount) }}</template>
                     </el-table-column>
                   </el-table>
                 </el-col>
@@ -163,8 +163,8 @@
               {{ u.fmt.fmtMoney(row[field.prop]) }}
             </template>
             <template v-else-if="field.prop==='action'">
-              <el-button v-if="row.status===0"  v-auth="'invoice.modify'"  size="small" plain  type="warning" @click="onRowClick('edit',row)">开票</el-button>
-              <el-button  v-if="row.status===1"    v-auth="'invoice.modify'"  size="small" plain  type="warning" @click="onRowClick('edit',row)">查看</el-button>
+              <el-button v-if="row.status===0" v-auth="'invoice.modify'" size="small" plain type="warning" @click="handleInvice(row)">开票</el-button>
+              <el-button v-if="row.status===1" v-auth="'invoice.modify'" size="small" plain type="success" @click="previewInvoice(row)">查看</el-button>
             </template>
             <template v-else>
               <div>{{ row[field.prop] }}</div>
@@ -178,6 +178,8 @@
     </el-card>
   </div>
   <InvoiceDialog ref="invoiceDialogRef" @refresh="loadData(true)"/>
+
+  <canvas ref="pdfViewer"></canvas>
 </template>
 
 <script setup lang="ts" name="InvoiceList">
@@ -195,10 +197,14 @@ import ExtDLabel from "/@/components/form/ExtDLabel.vue";
 
 const InvoiceDialog = defineAsyncComponent(() => import("/@/views/admin/invoice/dialog.vue"));
 
+import pdfjsLib from 'pdfjs-dist'
+
 //定义引用
 const queryRef = ref();
 const invoiceDialogRef = ref();
 
+const pdfViewer = ref()
+
 //定义变量
 const state = reactive({
   formQuery: {},
@@ -296,22 +302,55 @@ const loadData = (refresh: boolean = false) => {
   })
 };
 
+const handleInvice = (row: any) => {
+  Msg.confirm("请确认是否开票?").then(()=>{
+    $get(`/finance/handleInvoice/${row.id}`).then((res: any) => {
+      Msg.message("开票成功")
+      loadData(true)
+    }).catch(e => {
+      console.error(e)
+    })
+  })
+
+}
+
+
+const previewInvoice =   (row: any) => {
+  $get(`/finance/downloadInvoice/${row.id}`).then((res: any) => {
+    console.log(res)
+    let {downloadUrl} = res;
+    if (downloadUrl) {
+      window.open(downloadUrl, "_blank")
+
+      // doPriview(downloadUrl)
+
+    }
+  }).catch(e => {
+    console.error(e)
+  })
+}
+
+const doPriview=async  (url:string) =>{
+  const canvas = pdfViewer.value;
+  const loadingTask = pdfjsLib.getDocument(url)
+  const pdf = await loadingTask.promise
+  const page = await pdf.getPage(1)
+  const viewport = page.getViewport({ scale: 1.0 })
+  const context = canvas.getContext('2d')
+  canvas.height = viewport.height
+  canvas.width = viewport.width
+  const renderTask = page.render({
+    canvasContext: context,
+    viewport: viewport
+  })
+  await renderTask.promise
+}
+
 // 打开修改用户弹窗
 const onRowClick = (type: string, row: any) => {
   invoiceDialogRef.value.open(type, row);
 };
 
-// 删除用户
-const onRowDel = (row: any) => {
-  Msg.confirm(`此操作将永久删除:『${row.name}』,是否继续?`).then(() => {
-    $get(`/invoice/delete/${row.id}`).then(() => {
-      Msg.message("删除成功", 'success')
-    }).catch(() => {
-      Msg.message("删除失败", 'error')
-    })
-  });
-};
-
 const handleTableSelectionChange = (selection: any) => {
   console.log("handleTableSelectionChange>>", selection)
   // emit("on-check-change", selection)

+ 8 - 6
admin-web/src/views/admin/refund/index.vue

@@ -56,13 +56,13 @@
             @blur="loadData(true)"
             class="wd150 mr10">
         </el-input>
-        <el-input
+<!--        <el-input
             v-model="state.formQuery.outRefundNo"
             placeholder="商户退款单号"
             clearable
             @blur="loadData(true)"
             class="wd150 mr10">
-        </el-input>
+        </el-input>-->
         <el-input
             v-model="state.formQuery.outTradeNo"
             placeholder="商户订单号"
@@ -70,13 +70,13 @@
             @blur="loadData(true)"
             class="wd150 mr10">
         </el-input>
-        <el-input
+<!--        <el-input
             v-model="state.formQuery.refundId"
             placeholder="微信支付退款单号"
             clearable
             @blur="loadData(true)"
             class="wd150 mr10">
-        </el-input>
+        </el-input>-->
         <el-input
             v-model="state.formQuery.transactionId"
             placeholder="微信支付订单号"
@@ -130,7 +130,7 @@
               <ext-d-label type="Refund.status" v-model="row[field.prop]"/>
             </template>
             <template v-else-if="'action'===field.prop">
-              <el-button  v-if="!row.status"  size="small" plain  type="warning" @click="onRefundClick(row)">退款</el-button>
+              <el-button v-if="row.status==='PROCESSING'"  size="small" plain  type="warning" @click="onRefundClick(row)">退款</el-button>
             </template>
             <template v-else>
               <div>{{ row[field.prop] }}</div>
@@ -163,7 +163,9 @@ const queryRef = ref();
 
 //定义变量
 const state = reactive({
-  formQuery: {},
+  formQuery: {
+    status:'PROCESSING'
+  },
   pageQuery: {
     pageNum: 1,
     pageSize: 10,

+ 28 - 20
database/1.sql

@@ -24,24 +24,32 @@ values
 
 
 -- charge_app
-insert into charge_app.t_data_dict (id, code, name, weight, value, remark, create_time, update_time)
+insert into charge_app.t_data_dict ( code, name, weight, value, remark, create_time, update_time)
 values
-    (90, 'Banner.status', '有效', 1, '1', null, '2023-10-29 15:44:18', '2023-10-29 15:44:18'),
-    (91, 'Banner.status', '无效', 2, '0', null, '2023-10-29 15:44:18', '2023-10-29 15:44:18'),
-    (92, 'Activity.discountType', '服务费折扣', 1, 'RechargeRights', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
-    (93, 'Activity.discountType', '优惠券', 1, 'Coupon', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
-    (94, 'Activity.applyStation', '全部站点 ', 1, '0', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
-    (95, 'Activity.applyStation', '部分站点  ', 1, '1', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
-    (96, 'Activity.status', '未开始  ', 1, '0', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
-    (97, 'Activity.status', '进行中  ', 1, '1', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
-    (98, 'Activity.status', '已结束  ', 1, '2', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
-    (99, 'Activity.status', '已取消  ', 1, '3', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
-    (100, 'Activity.allowStacke', '允许', 1, '1', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
-    (101, 'Activity.allowStacke', '不允许', 1, '0', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
-    (102, 'Activity.targetUsers', '全部', 1, '0', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
-    (103, 'Activity.targetUsers', '新用户', 1, '1', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
-    (104, 'Activity.targetUsers', '老用户', 1, '2', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
-    (105, 'Invoice.status', '待开票', 1, '0', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
-    (106, 'Invoice.status', '已开票 ', 1, '1', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
-    (107, 'Invoice.type', '个人', 1, 'INDIVIDUAL', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
-    (108, 'Invoice.type', '企业', 1, 'ORGANIZATION', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47');
+    ( 'Banner.status', '有效', 1, '1', null, '2023-10-29 15:44:18', '2023-10-29 15:44:18'),
+    ( 'Banner.status', '无效', 2, '0', null, '2023-10-29 15:44:18', '2023-10-29 15:44:18'),
+    ( 'Activity.discountType', '服务费折扣', 1, 'RechargeRights', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
+    ( 'Activity.discountType', '优惠券', 1, 'Coupon', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
+    ( 'Activity.applyStation', '全部站点 ', 1, '0', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
+    ( 'Activity.applyStation', '部分站点  ', 1, '1', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
+    ( 'Activity.status', '未开始  ', 1, '0', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
+    ( 'Activity.status', '进行中  ', 1, '1', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
+    ( 'Activity.status', '已结束  ', 1, '2', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
+    ( 'Activity.status', '已取消  ', 1, '3', null, '2023-10-29 20:29:11', '2023-10-29 20:29:11'),
+    ( 'Activity.allowStacke', '允许', 1, '1', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
+    ( 'Activity.allowStacke', '不允许', 1, '0', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
+    ( 'Activity.targetUsers', '全部', 1, '0', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
+    ( 'Activity.targetUsers', '新用户', 1, '1', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
+    ( 'Activity.targetUsers', '老用户', 1, '2', null, '2023-10-29 20:34:38', '2023-10-29 20:34:38'),
+    ( 'Invoice.status', '待开票', 1, '0', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
+    ( 'Invoice.status', '已开票 ', 1, '1', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
+    ( 'Invoice.type', '个人', 1, 'INDIVIDUAL', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
+    ( 'Invoice.type', '企业', 1, 'ORGANIZATION', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
+    ( 'Invoice.status', '已作废 ', 1, '2', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
+    ( 'Invoice.status', '开票中 ', 1, '3', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
+    ( 'Refund.status', '退款成功 ', 1, 'SUCCESS', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
+    ( 'Refund.status', '退款关闭 ', 1, 'CLOSED', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
+    ( 'Refund.status', '退款处理中 ', 1, 'PROCESSING', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47'),
+    ( 'Refund.status', '退款异常 ', 1, 'ABNORMAL', null, '2023-10-29 21:51:47', '2023-10-29 21:51:47')
+
+;

+ 2 - 2
mapper/src/main/resources/mappers/miniapp/RefundLogMapper.xml

@@ -77,10 +77,10 @@
                                ON t2.id = t3.user_id) t4
             ON t1.user_id = t4.user_id
         <where>
-            <if test="params.mobilePhone != null">
+            <if test="params.mobilePhone != null and params.mobilePhone != ''  ">
                 and t4.mobile_phone = #{params.mobilePhone}
             </if>
-            <if test="params.status != null">
+            <if test="params.status != null and params.status !='' ">
                 and t1.status = #{params.status}
             </if>
             <if test="params.id != null">