提交提交

This commit is contained in:
Rhett霍 2026-02-12 14:41:15 +08:00
parent 9223df562c
commit 59703f3a7e
19 changed files with 2330 additions and 1862 deletions

View File

@ -0,0 +1,67 @@
import request from '@/utils/request'
// 文件列表
export function docList(data) {
return request({
url: '/bussiness/ApplyDetail/docList',
method: 'post',
data: data,
isEncrypt: false
})
}
// 法律文书 --详情 /bussiness/ApplyDetail/image
export function imageInfo(jwSecuritycheckId) {
return request({
url: '/bussiness/ApplyDetail/image?jwUploadId=' + jwSecuritycheckId,
method: 'get',
responseType: 'blob', // 设置响应类型为 blob
isEncrypt: false
})
}
// 法律文书 --上传 /bussiness/ApplyDetail/uploadFile
export function uploadFile(data) {
return request({
url: '/bussiness/ApplyDetail/uploadFile',
method: 'post',
// headers: { 'Content-Type': 'multipart/form-data' },
data: data,
isEncrypt: false
})
}
// 通用安全文件上传--通用文件上传
export function uploadSecurityFileByType(query,data) {
return request({
url: '/common/uploadSecurityFileByType',
method: 'post',
params: query,
data: data,
isEncrypt: false
})
}
// 通用上传文件下载-通用文件下载
export function securityFileDownload(query) {
return request({
url: '/common/securityFileDownload',
method: 'get',
params: query,
responseType: 'blob', // 设置响应类型为 blob
isEncrypt: false
})
}
// 分片上传大文件
export const pieceUpload = (data) => {
return request({
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
url: '/common/piece_upload',
data: data,
isEncrypt: false
})
}

View File

@ -1,4 +1,6 @@
import request from '@/utils/request' import request from '@/utils/request'
export function listsalemain(data,query) { export function listsalemain(data,query) {
return request({ return request({
url: '/bussiness/salemain/list', url: '/bussiness/salemain/list',
@ -101,3 +103,45 @@ export function delsalemain(id) {
// isEncrypt: false // isEncrypt: false
}) })
} }
// 订单详情中,查询商业用户详细--收货地址
export function BaseuserBusinessUserDetail(BaseuserBusinessUserId) {
return request({
url: '/baseInfo/baseuserbusiness/info?id=' + BaseuserBusinessUserId,
method: 'get',
isEncrypt: false
})
}
// 订单管理-实际发货清单
export function getSaleDisDetail(saleid) {
return request({
url: '/bussiness/salemain/getSaleDisDetail?saleId=' + saleid,
method: 'post',
isEncrypt: false
})
}
// 销售订单操作日志
export function salemainlogList(data,query) {
return request({
url: '/bussiness/salemainlog/list',
method: 'post',
data:data,
params: query,
isEncrypt: false
})
}
// 发货管理-订单管理--发票列表
export function getInvoiceList(saleid) {
return request({
url: '/bussiness/salemain/getInvoiceList?saleId=' + saleid,
method: 'post',
isEncrypt: false
})
}

View File

@ -0,0 +1,80 @@
<template>
<view>
<MBLoading v-if="loading" />
<uni-card
v-for="item in shipmentList"
:key="item.id"
:title="item.goodsname || '商品'"
>
<view class="context">
<view class="label">
<text>件装数:</text>
<text>{{ item.packingnum }}</text>
</view>
<view class="label">
<text>单价:</text>
<text>{{ formatPrice(item.invoiceprice) }}</text>
</view>
<view class="label">
<text>批号:</text>
<text>{{ item.batch }}</text>
</view>
<view class="label">
<text>数量分配:</text>
<text>{{ item.num }}</text>
</view>
<view class="label">
<text>件数:</text>
<text>{{ item.jianshu }}</text>
</view>
<view class="label">
<text>小计:</text>
<text>{{ item.total }}</text>
</view>
<view class="label">
<text>补差分配:</text>
<text>{{ item.sddpiaokou }}</text>
</view>
<view class="label">
<text>入库单号:</text>
<text>{{ item.instockno }}</text>
</view>
</view>
</uni-card>
<view v-if="!shipmentList || shipmentList.length === 0" class="empty-data">
<text>暂无实绩发货清单</text>
</view>
</view>
</template>
<script setup>
import { defineProps } from 'vue'
import { formatPrice } from "@/utils/utils.js";
import MBLoading from "@/components/MB/MBLoading.vue";
const props = defineProps({
shipmentList: {
type: Array,
default: () => []
},
loading: {
type: Boolean,
default: false
}
})
</script>
<style scoped>
.context {
font-size: 14px;
}
.context .label {
font-size: 14px;
}
.empty-data {
text-align: center;
padding: 30px;
color: #999;
font-size: 14px;
}
</style>

View File

@ -0,0 +1,132 @@
<template>
<view>
<MBLoading v-if="loading" />
<uni-card
v-for="item in invoiceList"
:key="item.id"
:title="item.invoicenum || '发票号'"
>
<view class="context">
<view class="label">
<text>发票金额:</text>
<text>{{ formatPrice(item.invoicevalue) }}</text>
</view>
<view class="label">
<text>开票日期:</text>
<text>{{ item.adddate }}</text>
</view>
<view class="label">
<text>快递单号:</text>
<text>{{ item.waybillnumber }}</text>
</view>
<view class="label">
<text>发票类型:</text>
<text>{{ item.billtypestr }}</text>
</view>
<view class="label">
<text>开票类型:</text>
<text>{{ item.billtype2str }}</text>
</view>
<view class="label">
<text style="min-width: 60px;">发票链接:</text>
<text
class="linka"
v-if="item.invoicefile"
@click="YuLanfile(item.invoicefile)"
>
{{ item.invoicefile.split('\\').pop() }}
</text>
<!-- <text class="linka">
<a href="javascript:void(0)"
v-if="item.invoicefile"
@click="YuLanfile(item.invoicefile)">
{{ item.invoicefile.split('\\').pop() }}
</a>
</text> -->
</view>
<view class="label">
<text>pdf链接:</text>
<text
class="linka"
v-if="item.pdf"
@click="YuLanfile(item.pdf)"
>
{{ item.pdf.split('.').pop() }}
</text>
<!-- <text>{{ item.pdf }}</text> -->
</view>
<view class="label">
<text>xml链接:</text>
<text
class="linka"
v-if="item.xml"
@click="YuLanfile(item.xml)"
>
{{ item.xml.split('.').pop() }}
</text>
<!-- <text>{{ item.xml }}</text> -->
</view>
<view class="label">
<text>ofd链接:</text>
<text
class="linka"
v-if="item.ofd"
@click="YuLanfile(item.ofd)"
>
{{ item.ofd.split('.').pop() }}
</text>
<!-- <text>{{ item.ofd }}</text> -->
</view>
<view class="label">
<text>状态:</text>
<text>{{ item.stateText }}</text>
</view>
</view>
</uni-card>
<view v-if="!invoiceList || invoiceList.length === 0" class="empty-data">
<text>暂无发票信息</text>
</view>
</view>
</template>
<script setup>
import { defineProps } from 'vue'
import { formatPrice,YuLanfile } from "@/utils/utils.js";
import { formatDate } from "@/uni_modules/uni-dateformat/components/uni-dateformat/date-format";
import MBLoading from "@/components/MB/MBLoading.vue";
const props = defineProps({
invoiceList: {
type: Array,
default: () => []
},
loading: {
type: Boolean,
default: false
}
})
</script>
<style scoped>
.linka{
color: #409eff;
text-decoration: underline;
}
a, a:focus, a:hover{
color: #409eff;
text-decoration: underline;
}
.context {
font-size: 14px;
}
.context .label {
font-size: 14px;
}
.empty-data {
text-align: center;
padding: 30px;
color: #999;
font-size: 14px;
}
</style>

View File

@ -0,0 +1,70 @@
<template>
<view>
<MBLoading v-if="loading" />
<uni-card
v-for="item in sortedData"
:key="item.goodsname"
:title="item.goodsname"
>
<view class="context">
<view class="label">
<text>操作人员:</text>
<text>{{ item.userName }}</text>
</view>
<view class="label">
<text>操作日期:</text>
<text>{{ item.editdate.substring(0, 16) }}</text>
</view>
<view class="label">
<text>操作内容:</text>
<text>{{item.memo }}</text>
</view>
</view>
</uni-card>
<view v-if="!sortedData || sortedData.length === 0" class="empty-data">
<text>暂无操作日志</text>
</view>
</view>
</template>
<script setup>
import { defineProps } from 'vue'
import { computed } from "vue";
import MBLoading from "@/components/MB/MBLoading.vue";
const props = defineProps({
logList: {
type: Array,
default: () => []
},
loading: {
type: Boolean,
default: false
}
})
const sortedData = computed(() => {
//
const data = [...props.logList];
// editdate
return data.sort((a, b) => new Date(b.editdate) - new Date(a.editdate));
})
console.log(props.logList)
</script>
<style scoped>
.context {
font-size: 14px;
}
.context .label {
font-size: 14px;
}
.empty-data {
text-align: center;
padding: 30px;
color: #999;
font-size: 14px;
}
.context{
grid-template-columns:repeat(1, minmax(0, 1fr))
}
</style>

View File

@ -0,0 +1,77 @@
<template>
<view>
<MBLoading v-if="loading" />
<uni-card
v-for="item in goodsList"
:key="item.goodsName"
:title="item.goodsName"
>
<view class="context">
<view class="label">
<text>件装数:</text>
<text>{{ item.packingNum }}</text>
</view>
<view class="label">
<text>单价:</text>
<text>{{ formatPrice(item.price) }}</text>
</view>
<view class="label">
<text>数量分配:</text>
<text>{{ item.goodsnum }}</text>
</view>
<view class="label">
<text>件数:</text>
<text>{{ item.packNumWithUnit }}</text>
</view>
<view class="label">
<text>小计:</text>
<text>{{ formatPrice(item.price * item.goodsnum ) }}</text>
</view>
<view class="label">
<text>补差分配:</text>
<text>{{ item.piaokou }}</text>
</view>
<view class="label">
<text>备注:</text>
<text>{{ item.remark }}</text>
</view>
</view>
</uni-card>
<view v-if="!goodsList || goodsList.length === 0" class="empty-data">
<text>暂无商品信息</text>
</view>
</view>
</template>
<script setup>
import { defineProps } from 'vue'
import { formatPrice } from "@/utils/utils.js";
import MBLoading from "@/components/MB/MBLoading.vue";
const props = defineProps({
goodsList: {
type: Array,
default: () => []
},
loading: {
type: Boolean,
default: false
}
})
</script>
<style scoped>
.context {
font-size: 14px;
}
.context .label {
font-size: 14px;
}
.empty-data {
text-align: center;
padding: 30px;
color: #999;
font-size: 14px;
}
</style>

View File

@ -2,8 +2,8 @@
export default { export default {
// baseUrl: 'https://vue.ruoyi.vip/prod-api', // // baseUrl: 'https://vue.ruoyi.vip/prod-api', //
// baseUrl: '/prod-api', //前后端分离版的接口地址,转发代理 设置在了manifest.json文件中 // baseUrl: '/prod-api', //前后端分离版的接口地址,转发代理 设置在了manifest.json文件中
// baseUrl: 'http://192.168.3.27:18090', //前后端分离版的接口地址 // baseUrl: 'http://192.168.99.25:18090', //前后端分离版的接口地址
baseUrl: 'http://106.15.139.36:18090', //前后端分离版的接口地址 baseUrl: '/prod-api', //前后端分离版的接口地址
//测试提交 //测试提交
// 应用信息 // 应用信息
appInfo: { appInfo: {

View File

@ -57,7 +57,12 @@
}, },
"vueVersion": "3", "vueVersion": "3",
"h5": { "h5": {
"template": "static/index.html" "template": "static/index.html",
"publicPath": "/h5/", // /h5/ ./
"router": {
"mode": "history", // "hash"
"base": "/h5/" // /h5/
}
// "devServer" : { // "devServer" : {
// "port" : 30088, // "port" : 30088,
// "https" : false, // "https" : false,
@ -79,7 +84,7 @@
"title": "RuoYi-App", "title": "RuoYi-App",
"router": { "router": {
"mode": "hash", "mode": "hash",
"base": "./" "base": "/h5/" //
} }
} }
} }

View File

@ -128,13 +128,21 @@
} }
}, },
{ {
"path": "pages/work/OrderManager/components/LookData", "path": "pages/work/OrderManager/components/LookDataSY",
"style": { "style": {
"navigationBarTitleText": "订单详情", "navigationBarTitleText": "订单详情",
"props": true "props": true
// props // props
} }
}, },
{
"path": "pages/work/OrderManager/components/LookDataNB",
"style": {
"navigationBarTitleText": "订单详情",
"props": true
// props
}
},
{ {
"path": "pages/work/OrderManager/components/NewAdd", "path": "pages/work/OrderManager/components/NewAdd",
"style": { "style": {

View File

@ -100,7 +100,7 @@
function loginSuccess(result) { function loginSuccess(result) {
// //
useUserStore().getInfo().then(res => { useUserStore().getInfo().then(res => {
proxy.$tab.reLaunch('/pages/index') proxy.$tab.reLaunch('pages/work/index')
}) })
} }

View File

@ -101,8 +101,6 @@
</view> </view>
</view> </view>
</uni-card> </uni-card>
<view style="display: flex;margin: 0 15px;justify-content: space-between;"> <view style="display: flex;margin: 0 15px;justify-content: space-between;">
<uni-tag <uni-tag
style="font-size: 20px;line-height: 28px;font-weight: bold;padding: 5px 25px;" style="font-size: 20px;line-height: 28px;font-weight: bold;padding: 5px 25px;"
@ -117,7 +115,6 @@
@click="handleSubmit" @click="handleSubmit"
/> />
</view> </view>
</view> </view>
</template> </template>

View File

@ -148,7 +148,14 @@ const Edit = async (row) => {
try { try {
console.log(row,'当前行数据') console.log(row,'当前行数据')
// //
const params = {
companyId: row.companyId,
saleid: row.saleid,
userid: row.userid,
}
// JSON
const paramsStr = encodeURIComponent(JSON.stringify(params))
proxy.$tab.navigateTo(`/pages/work/OrderManager/components/EditData?data=${paramsStr}`)
} catch (error) { } catch (error) {
console.error('失败:', error) console.error('失败:', error)
@ -220,6 +227,12 @@ const handleDetail = (row) => {
if(userType.value == '01' || userType.value == '02'){ if(userType.value == '01' || userType.value == '02'){
proxy.$tab.navigateTo(`/pages/work/OrderManager/components/LookDataSY?id=${row.saleid}`) proxy.$tab.navigateTo(`/pages/work/OrderManager/components/LookDataSY?id=${row.saleid}`)
}else{ }else{
// uni.showToast({
// title: '!',
// icon: 'none',
// duration: 2000
// })
// return false;
proxy.$tab.navigateTo(`/pages/work/OrderManager/components/LookDataNB?id=${row.saleid}`) proxy.$tab.navigateTo(`/pages/work/OrderManager/components/LookDataNB?id=${row.saleid}`)
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,590 +1,430 @@
<template> <template>
<view class="order-detail-container"> <view>
<!-- 基础信息区域 --> <uni-section
:title="form.usernames"
<view class="info-section"> titleFontSize="16px"
<uni-row class="info-grid"> padding="0 0 5px 10px"
<uni-col class="flex-row"> style="margin-bottom: 20px;"
<view class="label">生产单位: </view> />
<uni-data-select
v-model="form.companyId" <MBCard style="margin: 15px">
:localdata="companyOptions" <view class="context">
text-field="deptName" <view class="label">
value-field="deptId" <text>制单日期:</text>
@change="getEdu" <text>{{ formatDate(form.adddate, 'yyyy-MM-dd') }}</text>
:clear="true" </view>
disabled="true" <view class="label">
/> <text>合同编号:</text>
</uni-col> <text>{{ form.contractcode }}</text>
</uni-row> </view>
<uni-row class="info-grid"> <view class="label">
<uni-col :span="12"> <text>订单金额:</text>
<view class="label">剩余金额:{{ remainingMoney}}</view> <text>{{ formatPrice(form.contractmoney) }}</text>
</uni-col> </view>
<uni-col :span="12"> <view class="label">
<view class="label">订单金额:{{ orderAmount }}</view> <text>补差金额:</text>
</uni-col> <text>{{ formatPrice(form.disCount) }}</text>
</uni-row> </view>
<uni-row class="info-grid"> <view class="label">
<!-- <uni-col :span="24" style="display: flex;"> <text>签署日期:</text>
<view class="label">已选补差:</view> <text>{{ formatDate(form.piaokou) }}</text>
<view class=""> </view>
<view style="color: red;" v-if="buchaGoodsList.length&&selectedBuCha.length==0"> <view class="label">
提示:当前有补差数据可选择 <text>执行日期:</text>
</view> <text>{{ formatDate(form.piaokous) }}</text>
</view>
<view v-else class="" v-for="(item,index) in selectedBuCha" :key="index"> <view class="label">
商品{{item.goodsname}},金额{{item.piaokou}} <text>发货仓库:</text>
</view> <text>{{ form.warehouseName }}</text>
</view> </view>
</uni-col> --> <view class="label">
</uni-row> <text>导入用友日期:</text>
<text>{{ form.opdate }}</text>
</view> </view>
<view class="label">
<text>收货日期:</text>
<text>{{ form.getdate }}</text>
</view>
<view> <view class="label">
<!-- 商品信息区域 --> <text>发票确认日期:</text>
<view class="goods-section"> <text>{{ form.getbilldate }}</text>
<view class="section-title"> </view>
<view class="">
商品信息 <view class="label">
</view> <text>审核表(附件):</text>
<text
</view> class="linka"
<view v-if="goodsList.length === 0" class="no-data"> v-if="form.loadfile"
暂无商品数据 @click="YuLanfile(form.loadfile)"
</view> >
{{ form.loadfile.split('\\').pop() }}
<view v-else class="goods-double-column"> </text>
<view <!-- <text>{{ form.loadfile }}</text> -->
v-for="(goods, index) in goodsList" </view>
:key="goods.goodsid" <view class="label">
class="goods-item" <text>审核表(OA):</text>
> <text>{{ form.oaCode }}</text>
<view class="goods-header"> </view>
<view class="label">
<text class="serial-number">{{ index + 1 }}</text> <text style="min-width: 80px;">随货同行单:</text>
<text class="goods-name">{{ goods.goodsname }}</text> <text
class="linka"
v-if="form.billfile"
</view> @click="YuLanfile(form.billfile)"
>
<view class="goods-content"> {{ form.billfile.split('\\').pop() }}
</text>
<uni-row class="info-row"> </view>
<uni-col :span="12" class="info-pair"> <view class="label" v-if="form.pdffile">
<view class="label">件装数:{{ goods.packingnum }}</view> <text>合同(附件):</text>
</uni-col> <text
<uni-col :span="12" class="info-pair"> class="linka"
<view class="label">供应参考价:{{ goods.invoiceprice }}</view> v-if="form.form.pdffile"
</uni-col> @click="YuLanfile(form.form.pdffile)"
</uni-row> >
{{ form.form.pdffile.split('\\').pop() }}
</text>
<uni-row class="info-row"> <!-- <text>{{ form.pdffile }}</text> -->
<uni-col :span="12" class="info-pair"> </view>
<view class="label">前三月平均数:{{ goods.threeMonths }}</view> </view>
</uni-col> <view
<uni-col :span="12" class="info-pair"> style="display: flex;gap: 4px;font-size: 14px;color: #666;margin-bottom: 4px;margin-top:6px;font-weight: 500;flex-direction: column;
<view class="label">使用票扣:{{ goods.piaokou }}</view> width: 100%;">
</uni-col> <view style="width: 100%">发货地址:{{ form.place }}</view>
</uni-row> <!-- <view></view> -->
</view>
</MBCard>
<uni-row class="info-row">
<uni-col :span="12" class="info-pair"> <view class="viewunisection">
<view class="label">小计:{{ goods.allmoney }}</view> <uni-section>
</uni-col> <view class="uni-padding-wrap uni-common-mt">
<uni-col :span="12" class="info-pair"> <uni-segmented-control
<view class="label">税率:{{ goods.taxrate }}</view> :current="current"
</uni-col> :values="items"
</uni-row> style-type="text"
<uni-row class="info-row"> @clickItem="onClickItem"
<uni-col :span="12" class="info-pair flex-row" > />
<view class="label">采购数量:</view> </view>
<view class="label">税率:{{ goods.goodsnum }}</view> </uni-section>
<!-- <input </view>
class="uni-input custom-input"
v-model="goods.goodsnum" <!-- 根据当前标签页显示对应的组件 -->
placeholder="请输入采购数量" <view class="tab-content">
@confirm="e =>handleInput(e,index)"/> --> <!-- 商品信息 -->
</uni-col> <GoodsInfo
</uni-row> v-if="current === 0"
:goods-list="goodsList"
</view> :loading="loading"
/>
<!-- 实绩发货清单 -->
<ActualShipmentList
v-if="current === 1"
:shipment-list="ShopppingListtableData"
:loading="loading"
/>
<!-- 发票单 -->
<InvoiceList
v-if="current === 2"
:invoice-list="InvoicetableData"
:loading="loading"
/>
<!-- 操作日志 -->
<OperationLog
v-if="current === 3"
:log-list="OperationLogtableData"
:loading="loading"
/>
</view> </view>
</view>
</view> </view>
<!-- 操作按钮 -->
<view class="action-buttons">
<button @click="goCancel" class="btn btn-secondary">取消</button>
<!-- <button @click="goSubmit" class="btn btn-primary">确认提交</button> -->
</view>
</view>
</view>
</template> </template>
<script setup> <script setup>
import { addsalemain } from '../../../../api/orderManager/index.js' import { onLoad } from '@dcloudio/uni-app'
import { onMounted, ref } from 'vue'
import {
salemainDetail,
businessManagerReviewGoodsList,
getsalemaincheckAmount,
BaseuserBusinessUserDetail,
getSaleDisDetail,
salemainlogList,
listproductList,
getInvoiceList
} from '@/api/orderManager/index.js'
import { onMounted, ref ,computed} from 'vue' import { formatPrice,YuLanfile } from "@/utils/utils.js";
import { contractData, goodsData } from '../detailData.js' import { formatDate } from "@/uni_modules/uni-dateformat/components/uni-dateformat/date-format";
import { listsaleBusGoodsList } from '../../../../api/orderManager/index.js' import MBCard from "@/components/MB/MBCard.vue";
import { listproductList,salemainDetail,businessManagerReviewGoodsList,getsalemaincheckAmount } from '../../../../api/orderManager/index.js' import MBLoading from "@/components/MB/MBLoading.vue";
// import { getInfo } from '../../../../store/modules/user.js'
import { useUserStore } from '../../../../store/modules/user.js' //
import { useOrderManagerStore } from '../../../../store/modules/orderManager.js' import GoodsInfo from "@/components/SailMainComponents/OrderManagerCom/goodsListC.vue";
import data1 from './data1.js' import ActualShipmentList from "@/components/SailMainComponents/OrderManagerCom/ActualShipmentList.vue";
import InvoiceList from "@/components/SailMainComponents/OrderManagerCom/InvoiceList.vue";
import OperationLog from "@/components/SailMainComponents/OrderManagerCom/OperationLog.vue";
//
const loading = ref(false)
//
const selectedBuCha = ref([])
// //
const buchaGoodsList =ref([])
const goodsList = ref([]) const goodsList = ref([])
//
const form = ref({ const form = ref({
companyId:1, companyId: null,
}) })
const userStore = useUserStore()
const RemainingMoney = ref('0.00') // //
// const current = ref(0)
const buChaButState = ref(true)
// //
const allSelected = ref(false) const items = ref(['商品信息', '实绩发货清单', '发票单', '操作日志'])
//
const selectedList = ref([]) //
//
const ShowBucha = ref(false)
//
const remainingMoney = ref(0)
//
const orderAmount = ref(0.00)
//
const queryNum = ref({})
//
const contract = ref({})
//
const companyOptions = ref([]) const companyOptions = ref([])
const monthOptions = ref([
{ value: 0, text: '本月执行' },
{ value: 1, text: '下月执行' }
])
// //
// const formatMoney = (value) => {
// const num = Number(value)
// return isNaN(num)
// ? '0.00'
// : num.toLocaleString('en-US', {
// minimumFractionDigits: 2,
// maximumFractionDigits: 2
// })
// }
// //
// const formattedRemainingMoney = computed(() => formatMoney(RemainingMoney.value))
// const formattedContractMoney = computed(() => formatMoney(form.value.contractmoney))
onMounted(() => { //
// contract.value = contractData.data[0] const companyName = ref('')
// console.log(contract.value)
getEdu() //
getDeptLists() const remainingMoney = ref(0)
// GetlistsaleBusGoodsList()
getAllData() //
const orderAmount = ref(0.00)
//
const saleId = ref('')
//
const CommodityInfortableData = ref([])
//
const ShopppingListtableData = ref([])
//
const InvoicetableData = ref([])
//
const OperationLogtableData = ref([])
//
onLoad((options) => {
//
saleId.value = options.id || ''
console.log('接收到的 saleId:', saleId.value)
if (saleId.value) {
//
getDeptLists().then(() => {
getAllData()
})
} else {
uni.showToast({
title: '参数错误',
icon: 'error'
})
}
}) })
//
// console.log('saleid',saleid) //
const getAllData = () =>{ const getDeptLists = () => {
const rowdata = useOrderManagerStore().oeders[0] return listproductList().then(res => {
salemainDetail(rowdata.saleid).then(res => { if (res.code === 200 && res.data) {
form.value = res.data companyOptions.value = res.data
}); console.log('获取到部门列表:', companyOptions.value)
businessManagerReviewGoodsList(rowdata.saleid).then(res => { }
goodsList.value = res.data return res
}); })
//
const AmountqueryParams = {
companyId:rowdata.companyId,
saleId: rowdata.saleid,
}
getsalemaincheckAmount(AmountqueryParams).then(res => {
remainingMoney.value = res.data.amounts
});
} }
function GetlistsaleBusGoodsList() {
// // //
const KeSaleGoodsParams = { const getAllData = () => {
companyId:form.value.companyId, //
userid: userStore.id, GetsalemainDetail()
// userid: 41, }
deleteflag:0, // 0: 1: 2,
// state:1, //0,1 //
const onClickItem = (e) => {
if (current.value !== e.currentIndex) {
current.value = e.currentIndex
} }
// const KeSaleGoodsQuery = {
// pageNum: 1,
// pageSize: 999,
// }
listsaleBusGoodsList(KeSaleGoodsParams).then(res => {
goodsList.value = res.data
// console.log(' goodsList.value', goodsList.value)
});
// console.log(' userStore.id', userStore.id)
} }
//
const getDeptLists = () =>{ async function GetsalemainDetail() {
listproductList().then(res => { loading.value = true
companyOptions.value = res.data.map(item => {
return { try {
value:item.deptId, //
text:item.deptName await Promise.all([
} getSaleMainDetail().catch(err => {
}) console.error('获取订单详情失败:', err)
console.log('companyOptions.value', companyOptions.value) return null
}); }),
getsalemainlogList().catch(err => {
console.error('获取操作日志失败:', err)
return null
})
])
} finally {
// 使 setTimeout loading
setTimeout(() => {
loading.value = false
}, 300)
}
} }
/** 更改生产单位时,查询额度 */ //
const getSaleMainDetail = async () => {
//
await salemainDetail(saleId.value).then(res => {
form.value = res.data
goodsList.value = form.value.saledetailList || []
setCompanyName()
//
BaseuserBusinessUserDetail(res.data.userid).then(res => {
form.value.place = res.data.BaseUserBus?.place || ''
})
})
//
await getSaleDisDetailData()
//
await getInvoiceListData()
}
//
const getSaleDisDetailData = async () => {
await getSaleDisDetail(saleId.value).then(res => {
ShopppingListtableData.value = res.data || []
})
}
//
const getInvoiceListData = async () => {
await getInvoiceList(saleId.value).then(res => {
InvoicetableData.value = res.data || []
})
}
//
const getsalemainlogList = async () => {
const query = {
pageNum: 1,
pageSize: 1000,
isAsc: 'ascending',
orderByColumn: 'editdate'
}
const data = {
saleid: saleId.value
}
await salemainlogList(data, query).then(res => {
OperationLogtableData.value = res.rows || []
// editdate19T
OperationLogtableData.value.forEach(item => {
if (item.editdate && typeof item.editdate === 'string') {
item.editdate = item.editdate.substring(0, 19).replace('T', ' ');
}
})
})
}
// companyId
function setCompanyName() {
if (!form.value.companyId || !companyOptions.value.length) {
console.log('companyId 为空或部门列表为空')
companyName.value = ''
return
}
console.log('查找公司名称companyId:', form.value.companyId)
//
const company = companyOptions.value.find(item => item.deptId === form.value.companyId)
if (company) {
companyName.value = company.deptName
console.log('找到公司名称:', companyName.value)
} else {
companyName.value = '未知公司'
console.log('未找到对应的公司')
}
}
//
function calculateOrderAmount() {
if (!goodsList.value.length) {
orderAmount.value = 0
return
}
// allmoney
const total = goodsList.value.reduce((sum, item) => {
const money = parseFloat(item.allmoney) || 0
return sum + money
}, 0)
orderAmount.value = total
console.log('计算订单金额:', orderAmount.value)
}
//
function getEdu() { function getEdu() {
console.log(form.value.companyId,'form.value.companyId生产单位ID') const Amountform = {
// companyId: form.value.companyId,
const AmountqueryParams = { saleId: form.value.saleid,
companyId:form.value.companyId,
saleId: 0,
} }
console.log('查询额度参数:', Amountform)
// //
getsalemaincheckAmount(AmountqueryParams).then(res => { getsalemaincheckAmount(Amountform).then(res => {
remainingMoney.value = res.data.amounts if (res.code === 200) {
}); remainingMoney.value = res.data.amounts || 0
GetlistsaleBusGoodsList() console.log('获取到剩余额度:', remainingMoney.value)
// getsalemainpiAoKouList() }
}).catch(error => {
console.error('获取额度失败:', error)
})
} }
//
//
const goCancel = () => { const goCancel = () => {
uni.navigateTo({
uni.navigateTo({ url: '/pages/work/OrderManager/index'
url:'/pages/work/OrderManager/index' })
})
} }
</script> </script>
<style lang="scss" scoped> <style>
// ::v-deep .uni-checkbox-input { .linka{
// background-color: #fff !important; color: #409eff;
// border-color: #67c23a !important; text-decoration: underline;
// }
// ::v-deep .uni-checkbox-input-checked {
// background-color: #fff !important;
// color: #67c23a !important; /* */
// }
// ::v-deep .uni-checkbox-input svg{
// viewBox: 0 0 36 36;
// width: 22rpx;
// height: 22rpx;
// }
.select-all {
//
margin-left: auto;
// margin-left: 10rpx;
// background-color: #67c23a;
} }
.custom-input { a, a:focus, a:hover{
border: 1px solid #ccc; color: #409eff;
border-radius: 4px; text-decoration: underline;
padding: 5px; }
height: 25px; .context {
font-size: 14px;
} }
.order-detail-container { .context .label {
padding: 16px; font-size: 14px;
background-color: #f5f5f5;
min-height: 100vh;
} }
.flex-row { .uni-section .uni-section-header__content .distraction {
display: flex; font-weight: bold;
align-items: center; /* 垂直居中对齐 */
gap: 10px; /* 标签和下拉框之间的间距 */
} }
.viewunisection :deep().uni-section .uni-section-header {
.page-title { padding: 0;
text-align: center;
margin-bottom: 24px;
color: #333;
font-size: 18px;
font-weight: 600;
padding: 12px 0;
background: #fff;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
} }
.tab-content {
/* 基础信息网格布局 */ margin-top: 10px;
.info-section {
background: #fff;
border-radius: 12px;
padding: 16px;
margin-bottom: 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.info-grid {
:deep(.uni-row) {
display: flex;
flex-wrap: wrap;
}
.info-value {
font-size: 15px;
color: #333;
font-weight: 500;
display: flex;
justify-content: flex-end;
}
margin-bottom: 20rpx;
margin-top: 20rpx;
}
.info-item {
margin-bottom: 12px;
}
.label {
font-size: 14px;
color: #666;
margin-bottom: 4px;
font-weight: 500;
}
.required::after {
content: '*';
color: #f56c6c;
margin-left: 2px;
}
.amount {
color: #f56c6c;
font-weight: 600;
}
.select-container {
width: 100%;
}
:deep(.uni-data-select__text) {
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 8px;
background-color: #fff;
}
:deep(.month-popup) {
min-width: 120px;
}
/* 商品信息区域 */
.goods-section {
background: #fff;
border-radius: 12px;
padding: 16px;
margin-bottom: 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.section-title {
font-size: 16px;
color: #333;
margin: 0 0 16px 0;
padding-bottom: 8px;
border-bottom: 1px solid #eee;
font-weight: 600;
display: flex;
align-items: center;
}
.no-data {
text-align: center;
color: #999;
padding: 40px 0;
font-size: 14px;
}
/* 商品双栏布局 */
.goods-double-column {
display: flex;
flex-direction: column;
gap: 12px;
}
.goods-item {
border: 1px solid #eee;
border-radius: 12px;
overflow: hidden;
background: #fafafa;
}
.goods-header {
background: #409eff;
color: white;
padding: 5px 8px;
display: flex;
align-items: center;
gap: 12px;
}
.serial-number {
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
font-size: 12px;
font-weight: 600;
}
.goods-name {
font-size: 15px;
font-weight: 600;
flex: 1;
}
/* 商品内容区域 */
.goods-content {
padding: 12px 16px;
}
.info-row {
display: flex;
margin-bottom: 8px;
}
.info-pair {
flex: 1;
padding: 0 8px;
}
.info-pair .label {
font-size: 14px;
color: #666;
margin-bottom: 2px;
}
.info-pair .value {
font-size: 14px;
color: #333;
font-weight: 500;
text-align: right;
}
.quantity {
color: #409eff;
font-weight: 600;
}
.total {
color: #f56c6c;
font-weight: 600;
}
.empty {
visibility: hidden;
}
/* 操作按钮 */
.action-buttons {
display: flex;
justify-content: center;
gap: 12px;
padding: 16px 0;
background: #fff;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.btn {
padding: 12px 24px;
border: none;
border-radius: 8px;
font-size: 15px;
font-weight: 500;
cursor: pointer;
min-width: 80px;
text-align: center;
flex: 1;
}
.btn-primary {
background: #409eff;
color: white;
}
.btn-secondary {
background: #67c23a;
color: white;
}
.btn-outline {
background: #fff;
color: #333;
border: 1px solid #ddd;
}
/* 响应式设计 */
@media (max-width: 768px) {
.order-detail-container {
padding: 12px;
}
.info-item {
margin-bottom: 10px;
}
.info-pair {
padding: 0 4px;
}
.action-buttons {
flex-direction: column;
}
.btn {
width: 100%;
margin-bottom: 8px;
}
.btn:last-child {
margin-bottom: 0;
}
}
/* 添加多选框样式 */
.uni-checkbox {
display: inline-flex;
align-items: center;
margin-right: 8px;
} }
</style> </style>

View File

@ -1,590 +1,223 @@
<template> <template>
<view class="order-detail-container"> <view>
<!-- 基础信息区域 --> <MBCard style="border-radius: 0;">
<view class="" style="margin-bottom: 10px;">
<view class="info-section"> <view class="label">
<uni-row class="info-grid"> <text>生产单位:</text>
<uni-col class="flex-row"> <text>{{ companyName }}</text>
<view class="label">生产单位: </view> </view>
<uni-data-select </view>
v-model="form.companyId" <view class="context">
:localdata="companyOptions" <view class="label">
text-field="deptName" <text>剩余金额:</text>
value-field="deptId" <text>{{ formatPrice(remainingMoney) }}</text>
@change="getEdu" </view>
:clear="true" <view class="label">
disabled="true" <text>订单金额:</text>
/> <text>{{ formatPrice(orderAmount) }}</text>
</uni-col> </view>
</uni-row> </view>
<uni-row class="info-grid"> </MBCard>
<uni-col :span="12"> <uni-section class="mb-10" padding="0 0 5px 10px" title="商品信息"/>
<view class="label">剩余金额:{{ remainingMoney}}</view> <MBLoading v-if="loading"/>
</uni-col> <uni-card
<uni-col :span="12"> v-for="item in goodsList"
<view class="label">订单金额:{{ orderAmount }}</view> :key="item.goodsname"
</uni-col> :title="item.goodsname"
</uni-row>
<uni-row class="info-grid">
<!-- <uni-col :span="24" style="display: flex;">
<view class="label">已选补差:</view>
<view class="">
<view style="color: red;" v-if="buchaGoodsList.length&&selectedBuCha.length==0">
提示:当前有补差数据可选择
</view>
<view v-else class="" v-for="(item,index) in selectedBuCha" :key="index">
商品{{item.goodsname}},金额{{item.piaokou}}
</view>
</view>
</uni-col> -->
</uni-row>
</view>
<view>
<!-- 商品信息区域 -->
<view class="goods-section">
<view class="section-title">
<view class="">
商品信息
</view>
</view>
<view v-if="goodsList.length === 0" class="no-data">
暂无商品数据
</view>
<view v-else class="goods-double-column">
<view
v-for="(goods, index) in goodsList"
:key="goods.goodsid"
class="goods-item"
> >
<view class="goods-header">
<view class="context">
<text class="serial-number">{{ index + 1 }}</text> <view class="label">
<text class="goods-name">{{ goods.goodsname }}</text> <text>件装数:</text>
<text>{{ item.packingnum }}</text>
</view>
</view> <view class="label">
<text>供应参考价:</text>
<view class="goods-content"> <text>{{ item.invoiceprice }}</text>
</view>
<uni-row class="info-row"> <view class="label">
<uni-col :span="12" class="info-pair"> <text>前三月平均数:</text>
<view class="label">件装数:{{ goods.packingnum }}</view> <text>{{ formatPrice(item.mon3) }}</text>
</uni-col> </view>
<uni-col :span="12" class="info-pair"> <view class="label">
<view class="label">供应参考价:{{ goods.invoiceprice }}</view> <text>采购数量:</text>
</uni-col> <text>{{ item.goodsnum }}</text>
</uni-row> </view>
<view class="label">
<text>小计:</text>
<uni-row class="info-row"> <text>{{ formatPrice(item.allmoney) }}</text>
<uni-col :span="12" class="info-pair"> </view>
<view class="label">前三月平均数:{{ goods.threeMonths }}</view> <view class="label">
</uni-col> <text>使用票扣:</text>
<uni-col :span="12" class="info-pair"> <text>{{ formatPrice(item.piaokou) }}</text>
<view class="label">使用票扣:{{ goods.piaokou }}</view> </view>
</uni-col> <view class="label">
</uni-row> <text>税率:</text>
<text>{{ item.taxrate }}</text>
</view>
<uni-row class="info-row"> </view>
<uni-col :span="12" class="info-pair"> </uni-card>
<view class="label">小计:{{ goods.allmoney }}</view>
</uni-col>
<uni-col :span="12" class="info-pair">
<view class="label">税率:{{ goods.taxrate }}</view>
</uni-col>
</uni-row>
<uni-row class="info-row">
<uni-col :span="12" class="info-pair flex-row" >
<view class="label">采购数量:</view>
<view class="label">税率:{{ goods.goodsnum }}</view>
<!-- <input
class="uni-input custom-input"
v-model="goods.goodsnum"
placeholder="请输入采购数量"
@confirm="e =>handleInput(e,index)"/> -->
</uni-col>
</uni-row>
</view>
</view>
</view>
</view> </view>
<!-- 操作按钮 -->
<view class="action-buttons">
<button @click="goCancel" class="btn btn-secondary">取消</button>
<!-- <button @click="goSubmit" class="btn btn-primary">确认提交</button> -->
</view>
</view>
</view>
</template> </template>
<script setup> <script setup>
import { addsalemain } from '../../../../api/orderManager/index.js' import { onLoad } from '@dcloudio/uni-app'
import { onMounted, ref ,computed} from 'vue' import { onMounted, ref } from 'vue'
import { contractData, goodsData } from '../detailData.js' import { salemainDetail, businessManagerReviewGoodsList, getsalemaincheckAmount } from '../../../../api/orderManager/index.js'
import { listsaleBusGoodsList } from '../../../../api/orderManager/index.js' import { listproductList } from '../../../../api/orderManager/index.js'
import { listproductList,salemainDetail,businessManagerReviewGoodsList,getsalemaincheckAmount } from '../../../../api/orderManager/index.js' import { formatPrice } from "@/utils/utils";
// import { getInfo } from '../../../../store/modules/user.js' import MBCard from "@/components/MB/MBCard.vue";
import { useUserStore } from '../../../../store/modules/user.js' import MBLoading from "@/components/MB/MBLoading.vue";
import { useOrderManagerStore } from '../../../../store/modules/orderManager.js' const loading = ref(false)
import data1 from './data1.js'
//
const selectedBuCha = ref([])
// //
const buchaGoodsList =ref([])
const goodsList = ref([]) const goodsList = ref([])
const form = ref({ const form = ref({
companyId:1, companyId: null,
}) })
const userStore = useUserStore() //
const RemainingMoney = ref('0.00') //
//
const buChaButState = ref(true)
//
const allSelected = ref(false)
//
const selectedList = ref([])
//
const ShowBucha = ref(false)
//
const remainingMoney = ref(0)
//
const orderAmount = ref(0.00)
//
const queryNum = ref({})
//
const contract = ref({})
//
const companyOptions = ref([]) const companyOptions = ref([])
const monthOptions = ref([ //
{ value: 0, text: '本月执行' }, const companyName = ref('')
{ value: 1, text: '下月执行' } //
]) const remainingMoney = ref(0)
// // //
// const formatMoney = (value) => { const orderAmount = ref(0.00)
// const num = Number(value) //
// return isNaN(num) const saleId = ref('')
// ? '0.00'
// : num.toLocaleString('en-US', {
// minimumFractionDigits: 2,
// maximumFractionDigits: 2
// })
// }
// //
// const formattedRemainingMoney = computed(() => formatMoney(RemainingMoney.value))
// const formattedContractMoney = computed(() => formatMoney(form.value.contractmoney))
onMounted(() => { //
// contract.value = contractData.data[0] onLoad((options) => {
// console.log(contract.value) //
getEdu() saleId.value = options.id || ''
getDeptLists() console.log('接收到的 saleId:', saleId.value)
// GetlistsaleBusGoodsList()
getAllData() if (saleId.value) {
//
getDeptLists().then(() => {
getAllData()
})
} else {
uni.showToast({
title: '参数错误',
icon: 'error'
})
}
}) })
//
// console.log('saleid',saleid) //
const getAllData = () =>{ const getDeptLists = () => {
const rowdata = useOrderManagerStore().oeders[0] return listproductList().then(res => {
salemainDetail(rowdata.saleid).then(res => { if (res.code === 200 && res.data) {
form.value = res.data companyOptions.value = res.data
}); }
businessManagerReviewGoodsList(rowdata.saleid).then(res => { return res
goodsList.value = res.data })
});
//
const AmountqueryParams = {
companyId:rowdata.companyId,
saleId: rowdata.saleid,
}
getsalemaincheckAmount(AmountqueryParams).then(res => {
remainingMoney.value = res.data.amounts
});
} }
function GetlistsaleBusGoodsList() {
// // //
const KeSaleGoodsParams = { const getAllData = () => {
companyId:form.value.companyId, //
userid: userStore.id, GetsalemainDetail()
// userid: 41, }
deleteflag:0, // 0: 1: 2,
// state:1, //0,1 //
function GetsalemainDetail() {
loading.value = true
// 使 Promise.all
Promise.all([
salemainDetail(saleId.value),
businessManagerReviewGoodsList(saleId.value)
]).then(([detailRes, goodsRes]) => {
loading.value = false
//
form.value = detailRes.data
//
goodsList.value = goodsRes.data
//
calculateOrderAmount()
// companyId
setCompanyName()
//
getEdu()
}).catch(error => {
loading.value = false
uni.showToast({
title: '获取数据失败',
icon: 'error'
})
})
}
// companyId
function setCompanyName() {
if (!form.value.companyId || !companyOptions.value.length) {
companyName.value = ''
return
}
console.log('查找公司名称companyId:', form.value.companyId)
//
const company = companyOptions.value.find(item => item.deptId === form.value.companyId)
if (company) {
companyName.value = company.deptName
} else {
companyName.value = '未知公司'
} }
// const KeSaleGoodsQuery = {
// pageNum: 1,
// pageSize: 999,
// }
listsaleBusGoodsList(KeSaleGoodsParams).then(res => {
goodsList.value = res.data
// console.log(' goodsList.value', goodsList.value)
});
// console.log(' userStore.id', userStore.id)
} }
//
const getDeptLists = () =>{ function calculateOrderAmount() {
listproductList().then(res => { if (!goodsList.value.length) {
companyOptions.value = res.data.map(item => { orderAmount.value = 0
return { return
value:item.deptId, }
text:item.deptName
} // allmoney
}) const total = goodsList.value.reduce((sum, item) => {
console.log('companyOptions.value', companyOptions.value) const money = parseFloat(item.allmoney) || 0
}); return sum + money
}, 0)
orderAmount.value = total
} }
/** 更改生产单位时,查询额度 */ //
function getEdu() { function getEdu() {
console.log(form.value.companyId,'form.value.companyId生产单位ID')
//
const AmountqueryParams = { const AmountqueryParams = {
companyId:form.value.companyId, companyId: form.value.companyId,
saleId: 0, saleId: form.value.saleid,
} }
// //
getsalemaincheckAmount(AmountqueryParams).then(res => { getsalemaincheckAmount(AmountqueryParams).then(res => {
remainingMoney.value = res.data.amounts if (res.code === 200) {
}); remainingMoney.value = res.data.amounts || 0
GetlistsaleBusGoodsList() }
// getsalemainpiAoKouList() }).catch(error => {
console.error('获取额度失败:', error)
})
} }
//
//
const goCancel = () => { const goCancel = () => {
uni.navigateTo({
uni.navigateTo({ url: '/pages/work/OrderManager/index'
url:'/pages/work/OrderManager/index' })
})
} }
</script> </script>
<style>
<style lang="scss" scoped> .context{
// ::v-deep .uni-checkbox-input { font-size: 14px;
// background-color: #fff !important;
// border-color: #67c23a !important;
// }
// ::v-deep .uni-checkbox-input-checked {
// background-color: #fff !important;
// color: #67c23a !important; /* */
// }
// ::v-deep .uni-checkbox-input svg{
// viewBox: 0 0 36 36;
// width: 22rpx;
// height: 22rpx;
// }
.select-all {
//
margin-left: auto;
// margin-left: 10rpx;
// background-color: #67c23a;
} }
.custom-input { .context .label{
border: 1px solid #ccc; font-size: 14px;
border-radius: 4px; }
padding: 5px; </style>
height: 25px;
}
.order-detail-container {
padding: 16px;
background-color: #f5f5f5;
min-height: 100vh;
}
.flex-row {
display: flex;
align-items: center; /* 垂直居中对齐 */
gap: 10px; /* 标签和下拉框之间的间距 */
}
.page-title {
text-align: center;
margin-bottom: 24px;
color: #333;
font-size: 18px;
font-weight: 600;
padding: 12px 0;
background: #fff;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* 基础信息网格布局 */
.info-section {
background: #fff;
border-radius: 12px;
padding: 16px;
margin-bottom: 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.info-grid {
:deep(.uni-row) {
display: flex;
flex-wrap: wrap;
}
.info-value {
font-size: 15px;
color: #333;
font-weight: 500;
display: flex;
justify-content: flex-end;
}
margin-bottom: 20rpx;
margin-top: 20rpx;
}
.info-item {
margin-bottom: 12px;
}
.label {
font-size: 14px;
color: #666;
margin-bottom: 4px;
font-weight: 500;
}
.required::after {
content: '*';
color: #f56c6c;
margin-left: 2px;
}
.amount {
color: #f56c6c;
font-weight: 600;
}
.select-container {
width: 100%;
}
:deep(.uni-data-select__text) {
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 8px;
background-color: #fff;
}
:deep(.month-popup) {
min-width: 120px;
}
/* 商品信息区域 */
.goods-section {
background: #fff;
border-radius: 12px;
padding: 16px;
margin-bottom: 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.section-title {
font-size: 16px;
color: #333;
margin: 0 0 16px 0;
padding-bottom: 8px;
border-bottom: 1px solid #eee;
font-weight: 600;
display: flex;
align-items: center;
}
.no-data {
text-align: center;
color: #999;
padding: 40px 0;
font-size: 14px;
}
/* 商品双栏布局 */
.goods-double-column {
display: flex;
flex-direction: column;
gap: 12px;
}
.goods-item {
border: 1px solid #eee;
border-radius: 12px;
overflow: hidden;
background: #fafafa;
}
.goods-header {
background: #409eff;
color: white;
padding: 5px 8px;
display: flex;
align-items: center;
gap: 12px;
}
.serial-number {
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
font-size: 12px;
font-weight: 600;
}
.goods-name {
font-size: 15px;
font-weight: 600;
flex: 1;
}
/* 商品内容区域 */
.goods-content {
padding: 12px 16px;
}
.info-row {
display: flex;
margin-bottom: 8px;
}
.info-pair {
flex: 1;
padding: 0 8px;
}
.info-pair .label {
font-size: 14px;
color: #666;
margin-bottom: 2px;
}
.info-pair .value {
font-size: 14px;
color: #333;
font-weight: 500;
text-align: right;
}
.quantity {
color: #409eff;
font-weight: 600;
}
.total {
color: #f56c6c;
font-weight: 600;
}
.empty {
visibility: hidden;
}
/* 操作按钮 */
.action-buttons {
display: flex;
justify-content: center;
gap: 12px;
padding: 16px 0;
background: #fff;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.btn {
padding: 12px 24px;
border: none;
border-radius: 8px;
font-size: 15px;
font-weight: 500;
cursor: pointer;
min-width: 80px;
text-align: center;
flex: 1;
}
.btn-primary {
background: #409eff;
color: white;
}
.btn-secondary {
background: #67c23a;
color: white;
}
.btn-outline {
background: #fff;
color: #333;
border: 1px solid #ddd;
}
/* 响应式设计 */
@media (max-width: 768px) {
.order-detail-container {
padding: 12px;
}
.info-item {
margin-bottom: 10px;
}
.info-pair {
padding: 0 4px;
}
.action-buttons {
flex-direction: column;
}
.btn {
width: 100%;
margin-bottom: 8px;
}
.btn:last-child {
margin-bottom: 0;
}
}
/* 添加多选框样式 */
.uni-checkbox {
display: inline-flex;
align-items: center;
margin-right: 8px;
}
</style>

View File

@ -170,7 +170,6 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 商品列表操作按钮 --> <!-- 商品列表操作按钮 -->
<view class="action-buttons "> <view class="action-buttons ">
<button @click="goSave" class="btn btn-secondary" :loading="btnloading" :disabled="btnloading">保存</button> <button @click="goSave" class="btn btn-secondary" :loading="btnloading" :disabled="btnloading">保存</button>
@ -186,7 +185,6 @@ import { onMounted, ref, nextTick } from 'vue'
import { productListWithUserId, addsalemain, getsalemaincheckAmount, listsaleBusGoodsList, salemainpiAoKouList } from '../../../../api/orderManager/index.js' import { productListWithUserId, addsalemain, getsalemaincheckAmount, listsaleBusGoodsList, salemainpiAoKouList } from '../../../../api/orderManager/index.js'
import { useUserStore } from '@/store' import { useUserStore } from '@/store'
import MBLoading from "@/components/MB/MBLoading.vue"; import MBLoading from "@/components/MB/MBLoading.vue";
import data1 from './data1.js'
const userStore = useUserStore() const userStore = useUserStore()
const userID = ref(userStore.id) const userID = ref(userStore.id)
const loading = ref(true) const loading = ref(true)
@ -211,6 +209,7 @@ const tempSelectedItems = ref([]) // 临时选中的补差项
const companyOptions = ref([]) const companyOptions = ref([])
const isInitializing = ref(false) const isInitializing = ref(false)
onMounted(async () => { onMounted(async () => {
isInitializing.value = true isInitializing.value = true
try { try {
@ -321,7 +320,6 @@ function getEdu() {
} else { } else {
remainingMoney.value = 0 remainingMoney.value = 0
} }
GetlistsaleBusGoodsList() GetlistsaleBusGoodsList()
getsalemainpiAoKouList() getsalemainpiAoKouList()
}) })

View File

@ -1,122 +1,119 @@
// buchadata.js // buchadata.js
export default { export default {
data: [ data: [{
{ piaokouid: 1,
piaokouid: 1, goodsid: 1, // 对应盐酸丙卡特罗片(美普清)10
goodsid: 1, // 对应盐酸丙卡特罗片(美普清)10 applydate: "2024-01-15",
applydate: "2024-01-15", piaokoutype: "价格补差",
piaokoutype: "价格补差", shortname: "MPT10",
shortname: "MPT10", goodsname: "盐酸丙卡特罗片(美普清)10",
goodsname: "盐酸丙卡特罗片(美普清)10", piaokou: 100
piaokou: 100 },
}, {
{ piaokouid: 101,
piaokouid: 101, goodsid: 1, // 对应盐酸丙卡特罗片(美普清)10
goodsid: 1, // 对应盐酸丙卡特罗片(美普清)10 applydate: "2025-11-15",
applydate: "2025-11-15", piaokoutype: "价格补差",
piaokoutype: "价格补差", shortname: "MPT10",
shortname: "MPT10", goodsname: "盐酸丙卡特罗片(美普清)10",
goodsname: "盐酸丙卡特罗片(美普清)10", piaokou: 200
piaokou: 200 },
}, {
{ piaokouid: 2,
piaokouid: 2, goodsid: 3, // 对应盐酸丙卡特罗片(美普清)20
goodsid: 3, // 对应盐酸丙卡特罗片(美普清)20 applydate: "2024-01-16",
applydate: "2024-01-16", piaokoutype: "运费补差",
piaokoutype: "运费补差", shortname: "MPT20",
shortname: "MPT20", goodsname: "盐酸丙卡特罗片(美普清)20",
goodsname: "盐酸丙卡特罗片(美普清)20", piaokou: 10000.01
piaokou: 10000.01 },
}, {
{ piaokouid: 102,
piaokouid: 102, goodsid: 3, // 对应盐酸丙卡特罗片(美普清)20
goodsid: 3, // 对应盐酸丙卡特罗片(美普清)20 applydate: "2024-01-17",
applydate: "2024-01-17", piaokoutype: "运费补差",
piaokoutype: "运费补差", shortname: "MPT20",
shortname: "MPT20", goodsname: "盐酸丙卡特罗片(美普清)20",
goodsname: "盐酸丙卡特罗片(美普清)20", piaokou: 20000.02
piaokou: 20000.02 },
}, {
{ piaokouid: 3,
piaokouid: 3, goodsid: 5, // 对应瑞巴派特片(膜固思达)24
goodsid: 5, // 对应瑞巴派特片(膜固思达)24 applydate: "2024-01-17",
applydate: "2024-01-17", piaokoutype: "促销补差",
piaokoutype: "促销补差", shortname: "MCT24",
shortname: "MCT24", goodsname: "瑞巴派特片(膜固思达)24",
goodsname: "瑞巴派特片(膜固思达)24", piaokou: 12.80
piaokou: 12.80 },
}, {
{ piaokouid: 4,
piaokouid: 4, goodsid: 35, // 对应瑞巴派特片(膜固思达)48
goodsid: 35, // 对应瑞巴派特片(膜固思达)48 applydate: "2024-01-18",
applydate: "2024-01-18", piaokoutype: "价格补差",
piaokoutype: "价格补差", shortname: "MCT48",
shortname: "MCT48", goodsname: "瑞巴派特片(膜固思达)48",
goodsname: "瑞巴派特片(膜固思达)48", piaokou: 25.00
piaokou: 25.00 },
}, {
{ piaokouid: 5,
piaokouid: 5, goodsid: 6, // 对应阿立哌唑片(安律凡)5mg
goodsid: 6, // 对应阿立哌唑片(安律凡)5mg applydate: "2024-01-19",
applydate: "2024-01-19", piaokoutype: "运费补差",
piaokoutype: "运费补差", shortname: "ABF5",
shortname: "ABF5", goodsname: "阿立哌唑片(安律凡)5mg",
goodsname: "阿立哌唑片(安律凡)5mg", piaokou: 18.50
piaokou: 18.50 },
}, {
{ piaokouid: 6,
piaokouid: 6, goodsid: 8, // 对应托伐普坦片(苏麦卡)
goodsid: 8, // 对应托伐普坦片(苏麦卡) applydate: "2024-01-20",
applydate: "2024-01-20", piaokoutype: "促销补差",
piaokoutype: "促销补差", shortname: "SMC",
shortname: "SMC", goodsname: "托伐普坦片(苏麦卡)",
goodsname: "托伐普坦片(苏麦卡)", piaokou: 45.75
piaokou: 45.75 },
}, {
{ piaokouid: 7,
piaokouid: 7, goodsid: 10, // 对应白消安注射液(白舒非)
goodsid: 10, // 对应白消安注射液(白舒非) applydate: "2024-01-21",
applydate: "2024-01-21", piaokoutype: "价格补差",
piaokoutype: "价格补差", shortname: "BSF",
shortname: "BSF", goodsname: "白消安注射液(白舒非)",
goodsname: "白消安注射液(白舒非)", piaokou: 120.25
piaokou: 120.25 },
}, {
{ piaokouid: 8,
piaokouid: 8, goodsid: 33, // 对应德拉马尼片(德尔巴)
goodsid: 33, // 对应德拉马尼片(德尔巴) applydate: "2024-01-22",
applydate: "2024-01-22", piaokoutype: "运费补差",
piaokoutype: "运费补差", shortname: "DLM",
shortname: "DLM", goodsname: "德拉马尼片(德尔巴)",
goodsname: "德拉马尼片(德尔巴)", piaokou: 280.00
piaokou: 280.00 },
}, {
{ piaokouid: 9,
piaokouid: 9, goodsid: 39, // 对应注射用阿立哌唑0.4g
goodsid: 39, // 对应注射用阿立哌唑0.4g applydate: "2024-01-23",
applydate: "2024-01-23", piaokoutype: "促销补差",
piaokoutype: "促销补差", shortname: "AOM400",
shortname: "AOM400", goodsname: "注射用阿立哌唑0.4g",
goodsname: "注射用阿立哌唑0.4g", piaokou: 95.90
piaokou: 95.90 },
}, {
{ piaokouid: 10,
piaokouid: 10, goodsid: 41, // 对应布瑞哌唑片(锐思定)1mg
goodsid: 41, // 对应布瑞哌唑片(锐思定)1mg applydate: "2024-01-24",
applydate: "2024-01-24", piaokoutype: "价格补差",
piaokoutype: "价格补差", shortname: "RXT1",
shortname: "RXT1", goodsname: "布瑞哌唑片(锐思定)1mg",
goodsname: "布瑞哌唑片(锐思定)1mg", piaokou: 22.40
piaokou: 22.40 },
}, {
{ piaokouid: 11,
piaokouid: 11, goodsid: 42, // 对应泊那替尼片英可欣15mg
goodsid: 42, // 对应泊那替尼片英可欣15mg applydate: "2024-01-25",
applydate: "2024-01-25", piaokoutype: "运费补差",
piaokoutype: "运费补差", shortname: "ISG",
shortname: "ISG", goodsname: "泊那替尼片英可欣15mg",
goodsname: "泊那替尼片英可欣15mg", piaokou: 350.60
piaokou: 350.60 }
}
]
};

View File

@ -4,7 +4,7 @@
<uni-forms ref="baseForm" :modelValue="queryParams"> <uni-forms ref="baseForm" :modelValue="queryParams">
<uni-forms-item label="货主"> <uni-forms-item label="货主">
<uni-data-select <uni-data-select
v-model="queryParams.CompanyId" v-model="queryParams.companyId"
:clear="true" :clear="true"
:localdata="companyOptions" :localdata="companyOptions"
text-field="deptName" text-field="deptName"

View File

@ -1,3 +1,545 @@
export const formatPrice = (value) => { export const formatPrice = (value) => {
return Number(value).toFixed(2) return Number(value).toFixed(2)
}
import {securityFileDownload} from '@/api/FileUpload/FileUpload.js'
// 移动端文件预览优化版 - H5兼容修复
export const YuLanfile = async (filePath) => {
uni.showToast({
title: '预览还在开发完善中!!',
icon: 'none',
duration: 2000
})
return false;
console.log("预览文件:", filePath)
if (!filePath) {
uni.showToast({
title: '文件路径不存在',
icon: 'none'
});
return;
}
try {
uni.showLoading({
title: '正在加载文件...',
mask: true
});
const response = await securityFileDownload({
fileName: filePath,
delete: false
});
const fileExtension = filePath.split('.').pop().toLowerCase();
const fileName = filePath.split('\\').pop() || 'preview.' + fileExtension;
// 判断运行环境
const platform = getPlatform();
console.log('当前平台:', platform);
// 根据平台和文件类型选择预览方式
if (['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(fileExtension)) {
await previewImage(response, fileExtension, fileName, platform);
} else if (fileExtension === 'pdf') {
await previewPDF(response, fileName, platform);
} else {
await handleOtherFile(response, fileName, fileExtension, platform);
}
uni.hideLoading();
} catch (error) {
console.error('预览失败:', error);
uni.hideLoading();
uni.showToast({
title: '预览失败: ' + (error.message || '未知错误'),
icon: 'none'
});
}
}
// 获取平台
const getPlatform = () => {
// #ifdef H5
return 'h5';
// #endif
// #ifdef APP-PLUS
return 'app';
// #endif
// #ifdef MP-WEIXIN
return 'weixin';
// #endif
return 'h5'; // 默认
}
// 图片预览
const previewImage = async (response, fileExtension, fileName, platform) => {
return new Promise((resolve, reject) => {
const blob = new Blob([response], {
type: `image/${fileExtension === 'jpg' ? 'jpeg' : fileExtension}`
});
// H5环境 - 使用简单可靠的方式
if (platform === 'h5') {
const blobUrl = URL.createObjectURL(blob);
// 创建图片预览模态框
showImageModalH5(blobUrl, fileName, resolve);
return;
}
// App环境
if (platform === 'app') {
const reader = new FileReader();
reader.onload = (e) => {
const base64 = e.target.result;
uni.previewImage({
current: 0,
urls: [base64],
success: () => resolve(),
fail: (err) => {
console.error('预览图片失败:', err);
const blobUrl = URL.createObjectURL(blob);
window.open(blobUrl, '_blank');
resolve();
}
});
};
reader.readAsDataURL(blob);
return;
}
// 微信小程序环境
if (platform === 'weixin') {
const reader = new FileReader();
reader.onload = (e) => {
const base64 = e.target.result;
wx.getFileSystemManager().writeFile({
filePath: wx.env.USER_DATA_PATH + '/temp_' + Date.now() + '.' + fileExtension,
data: base64.replace(/^data:image\/\w+;base64,/, ''),
encoding: 'base64',
success: (res) => {
wx.previewImage({
current: 0,
urls: [res.filePath],
success: () => resolve(),
fail: (err) => reject(err)
});
},
fail: (err) => reject(err)
});
};
reader.readAsDataURL(blob);
}
});
}
// H5图片预览模态框
const showImageModalH5 = (imageUrl, fileName, resolve) => {
// 移除已存在的模态框
const existingModal = document.getElementById('h5-preview-modal');
if (existingModal) {
document.body.removeChild(existingModal);
}
const modal = document.createElement('div');
modal.id = 'h5-preview-modal';
modal.style.cssText = `
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.9);
z-index: 999999;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
`;
const header = document.createElement('div');
header.style.cssText = `
position: absolute;
top: 0;
left: 0;
right: 0;
height: 50px;
background: rgba(0,0,0,0.5);
color: white;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
z-index: 1000000;
`;
header.innerHTML = `
<span style="font-size: 16px; color: white;">${fileName}</span>
<span style="font-size: 30px; cursor: pointer; color: white; padding: 0 10px;">×</span>
`;
const img = document.createElement('img');
img.src = imageUrl;
img.style.cssText = `
max-width: 100%;
max-height: 100%;
object-fit: contain;
`;
// 关闭按钮点击
header.querySelector('span:last-child').onclick = () => {
document.body.removeChild(modal);
URL.revokeObjectURL(imageUrl);
resolve();
};
// 点击背景关闭
modal.onclick = (e) => {
if (e.target === modal) {
document.body.removeChild(modal);
URL.revokeObjectURL(imageUrl);
resolve();
}
};
// 按ESC关闭
const escHandler = (e) => {
if (e.key === 'Escape') {
document.body.removeChild(modal);
URL.revokeObjectURL(imageUrl);
document.removeEventListener('keydown', escHandler);
resolve();
}
};
document.addEventListener('keydown', escHandler);
modal.appendChild(header);
modal.appendChild(img);
document.body.appendChild(modal);
}
// PDF预览
const previewPDF = async (response, fileName, platform) => {
return new Promise((resolve, reject) => {
const blob = new Blob([response], { type: 'application/pdf' });
// H5环境
if (platform === 'h5') {
const blobUrl = URL.createObjectURL(blob);
showPDFModalH5(blobUrl, fileName, resolve);
return;
}
// App环境
if (platform === 'app') {
const reader = new FileReader();
reader.onload = (e) => {
const arrayBuffer = e.target.result;
const base64Data = arrayBufferToBase64(arrayBuffer);
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function(fs) {
fs.root.getFile(fileName, {create: true}, function(fileEntry) {
fileEntry.createWriter(function(writer) {
writer.onwrite = function() {
plus.runtime.openFile(fileEntry.toLocalURL());
resolve();
};
writer.onerror = reject;
writer.writeAsBinary(atob(base64Data));
}, reject);
}, reject);
}, reject);
};
reader.readAsArrayBuffer(blob);
return;
}
// 微信小程序环境
if (platform === 'weixin') {
const reader = new FileReader();
reader.onload = (e) => {
const arrayBuffer = e.target.result;
const base64Data = arrayBufferToBase64(arrayBuffer);
wx.getFileSystemManager().writeFile({
filePath: wx.env.USER_DATA_PATH + '/' + fileName,
data: base64Data,
encoding: 'base64',
success: (res) => {
wx.openDocument({
filePath: wx.env.USER_DATA_PATH + '/' + fileName,
success: () => resolve(),
fail: (err) => reject(err)
});
},
fail: (err) => reject(err)
});
};
reader.readAsArrayBuffer(blob);
}
});
}
// H5 PDF预览模态框
const showPDFModalH5 = (pdfUrl, fileName, resolve) => {
// 移除已存在的模态框
const existingModal = document.getElementById('h5-preview-modal');
if (existingModal) {
document.body.removeChild(existingModal);
}
const modal = document.createElement('div');
modal.id = 'h5-preview-modal';
modal.style.cssText = `
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: white;
z-index: 999999;
display: flex;
flex-direction: column;
`;
const header = document.createElement('div');
header.style.cssText = `
height: 50px;
background: #f5f5f5;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
border-bottom: 1px solid #ddd;
`;
header.innerHTML = `
<span style="font-size: 16px; color: #333;">${fileName}</span>
<span style="font-size: 30px; color: #999; cursor: pointer; padding: 0 10px;">×</span>
`;
const iframe = document.createElement('iframe');
iframe.src = pdfUrl;
iframe.style.cssText = `
width: 100%;
flex: 1;
border: none;
`;
// 关闭按钮
header.querySelector('span:last-child').onclick = () => {
document.body.removeChild(modal);
URL.revokeObjectURL(pdfUrl);
resolve();
};
// 按ESC关闭
const escHandler = (e) => {
if (e.key === 'Escape') {
document.body.removeChild(modal);
URL.revokeObjectURL(pdfUrl);
document.removeEventListener('keydown', escHandler);
resolve();
}
};
document.addEventListener('keydown', escHandler);
modal.appendChild(header);
modal.appendChild(iframe);
document.body.appendChild(modal);
}
// 处理其他文件
const handleOtherFile = async (response, fileName, fileExtension, platform) => {
return new Promise((resolve, reject) => {
uni.showActionSheet({
itemList: ['预览文件', '保存到本地', '取消'],
success: async (res) => {
if (res.tapIndex === 0) {
await openWithDefaultApp(response, fileName, fileExtension, platform);
resolve();
} else if (res.tapIndex === 1) {
await saveFile(response, fileName, platform);
resolve();
} else {
resolve();
}
},
fail: (err) => reject(err)
});
});
}
// 使用默认应用打开
const openWithDefaultApp = (response, fileName, fileExtension, platform) => {
return new Promise((resolve, reject) => {
const blob = new Blob([response]);
// H5环境
if (platform === 'h5') {
const blobUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = blobUrl;
a.download = fileName;
a.click();
URL.revokeObjectURL(blobUrl);
uni.showToast({
title: '开始下载',
icon: 'success'
});
resolve();
return;
}
// App环境
if (platform === 'app') {
const reader = new FileReader();
reader.onload = (e) => {
const arrayBuffer = e.target.result;
const base64Data = arrayBufferToBase64(arrayBuffer);
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function(fs) {
fs.root.getFile(fileName, {create: true}, function(fileEntry) {
fileEntry.createWriter(function(writer) {
writer.onwrite = function() {
plus.runtime.openFile(fileEntry.toLocalURL());
resolve();
};
writer.onerror = reject;
writer.writeAsBinary(atob(base64Data));
}, reject);
}, reject);
}, reject);
};
reader.readAsArrayBuffer(blob);
return;
}
// 微信小程序环境
if (platform === 'weixin') {
const reader = new FileReader();
reader.onload = (e) => {
const arrayBuffer = e.target.result;
const base64Data = arrayBufferToBase64(arrayBuffer);
wx.getFileSystemManager().writeFile({
filePath: wx.env.USER_DATA_PATH + '/' + fileName,
data: base64Data,
encoding: 'base64',
success: (res) => {
wx.openDocument({
filePath: wx.env.USER_DATA_PATH + '/' + fileName,
success: () => resolve(),
fail: (err) => reject(err)
});
},
fail: (err) => reject(err)
});
};
reader.readAsArrayBuffer(blob);
}
});
}
// 保存文件
const saveFile = (response, fileName, platform) => {
return new Promise((resolve, reject) => {
const blob = new Blob([response]);
// H5环境
if (platform === 'h5') {
const blobUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = blobUrl;
a.download = fileName;
a.click();
URL.revokeObjectURL(blobUrl);
uni.showToast({
title: '开始下载',
icon: 'success'
});
resolve();
return;
}
// App环境
if (platform === 'app') {
const reader = new FileReader();
reader.onload = (e) => {
const arrayBuffer = e.target.result;
const base64Data = arrayBufferToBase64(arrayBuffer);
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function(fs) {
fs.root.getFile(fileName, {create: true}, function(fileEntry) {
fileEntry.createWriter(function(writer) {
writer.onwrite = function() {
uni.showToast({
title: '保存成功',
icon: 'success'
});
resolve();
};
writer.onerror = reject;
writer.writeAsBinary(atob(base64Data));
}, reject);
}, reject);
}, reject);
};
reader.readAsArrayBuffer(blob);
return;
}
// 微信小程序环境
if (platform === 'weixin') {
const reader = new FileReader();
reader.onload = (e) => {
const arrayBuffer = e.target.result;
const base64Data = arrayBufferToBase64(arrayBuffer);
wx.getFileSystemManager().writeFile({
filePath: wx.env.USER_DATA_PATH + '/' + fileName,
data: base64Data,
encoding: 'base64',
success: (res) => {
uni.showToast({
title: '保存成功',
icon: 'success'
});
resolve();
},
fail: (err) => reject(err)
});
};
reader.readAsArrayBuffer(blob);
}
});
}
// ArrayBuffer 转 Base64
const arrayBufferToBase64 = (buffer) => {
let binary = '';
const bytes = new Uint8Array(buffer);
const len = bytes.byteLength;
for (let i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return btoa(binary);
}
// 获取MIME类型
const getMimeType = (extension) => {
const mimeTypes = {
'png': 'image/png',
'jpg': 'image/jpeg',
'jpeg': 'image/jpeg',
'gif': 'image/gif',
'pdf': 'application/pdf',
'doc': 'application/msword',
'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xls': 'application/vnd.ms-excel',
'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'txt': 'text/plain'
};
return mimeTypes[extension] || 'application/octet-stream';
} }