提交提交
This commit is contained in:
parent
9223df562c
commit
59703f3a7e
67
api/FileUpload/FileUpload.js
Normal file
67
api/FileUpload/FileUpload.js
Normal 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
|
||||
})
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
|
||||
export function listsalemain(data,query) {
|
||||
return request({
|
||||
url: '/bussiness/salemain/list',
|
||||
@ -101,3 +103,45 @@ export function delsalemain(id) {
|
||||
// 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
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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>
|
||||
132
components/SailMainComponents/OrderManagerCom/InvoiceList.vue
Normal file
132
components/SailMainComponents/OrderManagerCom/InvoiceList.vue
Normal 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>
|
||||
@ -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>
|
||||
77
components/SailMainComponents/OrderManagerCom/goodsListC.vue
Normal file
77
components/SailMainComponents/OrderManagerCom/goodsListC.vue
Normal 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>
|
||||
@ -2,8 +2,8 @@
|
||||
export default {
|
||||
// baseUrl: 'https://vue.ruoyi.vip/prod-api', //
|
||||
// baseUrl: '/prod-api', //前后端分离版的接口地址,转发代理 设置在了manifest.json文件中
|
||||
// baseUrl: 'http://192.168.3.27:18090', //前后端分离版的接口地址
|
||||
baseUrl: 'http://106.15.139.36:18090', //前后端分离版的接口地址
|
||||
// baseUrl: 'http://192.168.99.25:18090', //前后端分离版的接口地址
|
||||
baseUrl: '/prod-api', //前后端分离版的接口地址
|
||||
//测试提交
|
||||
// 应用信息
|
||||
appInfo: {
|
||||
|
||||
@ -57,7 +57,12 @@
|
||||
},
|
||||
"vueVersion": "3",
|
||||
"h5": {
|
||||
"template": "static/index.html"
|
||||
"template": "static/index.html",
|
||||
"publicPath": "/h5/", // 关键修改:改为 /h5/,不是 ./
|
||||
"router": {
|
||||
"mode": "history", // 或 "hash"
|
||||
"base": "/h5/" // 关键修改:设置为 /h5/
|
||||
}
|
||||
// "devServer" : {
|
||||
// "port" : 30088,
|
||||
// "https" : false,
|
||||
@ -79,7 +84,7 @@
|
||||
"title": "RuoYi-App",
|
||||
"router": {
|
||||
"mode": "hash",
|
||||
"base": "./"
|
||||
"base": "/h5/" // 这里也要改
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
pages.json
10
pages.json
@ -128,13 +128,21 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/work/OrderManager/components/LookData",
|
||||
"path": "pages/work/OrderManager/components/LookDataSY",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情",
|
||||
"props": true
|
||||
// 开启 props 传参
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/work/OrderManager/components/LookDataNB",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情",
|
||||
"props": true
|
||||
// 开启 props 传参
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/work/OrderManager/components/NewAdd",
|
||||
"style": {
|
||||
|
||||
@ -100,7 +100,7 @@
|
||||
function loginSuccess(result) {
|
||||
// 设置用户信息
|
||||
useUserStore().getInfo().then(res => {
|
||||
proxy.$tab.reLaunch('/pages/index')
|
||||
proxy.$tab.reLaunch('pages/work/index')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -101,8 +101,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-card>
|
||||
|
||||
|
||||
<view style="display: flex;margin: 0 15px;justify-content: space-between;">
|
||||
<uni-tag
|
||||
style="font-size: 20px;line-height: 28px;font-weight: bold;padding: 5px 25px;"
|
||||
@ -117,7 +115,6 @@
|
||||
@click="handleSubmit"
|
||||
/>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@ -148,7 +148,14 @@ const Edit = async (row) => {
|
||||
try {
|
||||
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) {
|
||||
console.error('失败:', error)
|
||||
@ -220,6 +227,12 @@ const handleDetail = (row) => {
|
||||
if(userType.value == '01' || userType.value == '02'){
|
||||
proxy.$tab.navigateTo(`/pages/work/OrderManager/components/LookDataSY?id=${row.saleid}`)
|
||||
}else{
|
||||
// uni.showToast({
|
||||
// title: '内部用户查看还在开发完善中!!',
|
||||
// icon: 'none',
|
||||
// duration: 2000
|
||||
// })
|
||||
// return false;
|
||||
proxy.$tab.navigateTo(`/pages/work/OrderManager/components/LookDataNB?id=${row.saleid}`)
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,590 +1,430 @@
|
||||
<template>
|
||||
<view class="order-detail-container">
|
||||
<!-- 基础信息区域 -->
|
||||
|
||||
<view class="info-section">
|
||||
<uni-row class="info-grid">
|
||||
<uni-col class="flex-row">
|
||||
<view class="label">生产单位: </view>
|
||||
<uni-data-select
|
||||
v-model="form.companyId"
|
||||
:localdata="companyOptions"
|
||||
text-field="deptName"
|
||||
value-field="deptId"
|
||||
@change="getEdu"
|
||||
:clear="true"
|
||||
disabled="true"
|
||||
/>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row class="info-grid">
|
||||
<uni-col :span="12">
|
||||
<view class="label">剩余金额:{{ remainingMoney}}</view>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<view class="label">订单金额:{{ orderAmount }}</view>
|
||||
</uni-col>
|
||||
</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">
|
||||
|
||||
<text class="serial-number">{{ index + 1 }}</text>
|
||||
<text class="goods-name">{{ goods.goodsname }}</text>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<view class="goods-content">
|
||||
|
||||
<uni-row class="info-row">
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<view class="label">件装数:{{ goods.packingnum }}</view>
|
||||
</uni-col>
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<view class="label">供应参考价:{{ goods.invoiceprice }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
|
||||
<uni-row class="info-row">
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<view class="label">前三月平均数:{{ goods.threeMonths }}</view>
|
||||
</uni-col>
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<view class="label">使用票扣:{{ goods.piaokou }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
|
||||
<uni-row class="info-row">
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<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>
|
||||
<uni-section
|
||||
:title="form.usernames"
|
||||
titleFontSize="16px"
|
||||
padding="0 0 5px 10px"
|
||||
style="margin-bottom: 20px;"
|
||||
/>
|
||||
|
||||
<MBCard style="margin: 15px">
|
||||
<view class="context">
|
||||
<view class="label">
|
||||
<text>制单日期:</text>
|
||||
<text>{{ formatDate(form.adddate, 'yyyy-MM-dd') }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>合同编号:</text>
|
||||
<text>{{ form.contractcode }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>订单金额:</text>
|
||||
<text>{{ formatPrice(form.contractmoney) }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>补差金额:</text>
|
||||
<text>{{ formatPrice(form.disCount) }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>签署日期:</text>
|
||||
<text>{{ formatDate(form.piaokou) }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>执行日期:</text>
|
||||
<text>{{ formatDate(form.piaokous) }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>发货仓库:</text>
|
||||
<text>{{ form.warehouseName }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>导入用友日期:</text>
|
||||
<text>{{ form.opdate }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>收货日期:</text>
|
||||
<text>{{ form.getdate }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>发票确认日期:</text>
|
||||
<text>{{ form.getbilldate }}</text>
|
||||
</view>
|
||||
|
||||
<view class="label">
|
||||
<text>审核表(附件):</text>
|
||||
<text
|
||||
class="linka"
|
||||
v-if="form.loadfile"
|
||||
@click="YuLanfile(form.loadfile)"
|
||||
>
|
||||
{{ form.loadfile.split('\\').pop() }}
|
||||
</text>
|
||||
<!-- <text>{{ form.loadfile }}</text> -->
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>审核表(OA):</text>
|
||||
<text>{{ form.oaCode }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text style="min-width: 80px;">随货同行单:</text>
|
||||
<text
|
||||
class="linka"
|
||||
v-if="form.billfile"
|
||||
@click="YuLanfile(form.billfile)"
|
||||
>
|
||||
{{ form.billfile.split('\\').pop() }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="label" v-if="form.pdffile">
|
||||
<text>合同(附件):</text>
|
||||
<text
|
||||
class="linka"
|
||||
v-if="form.form.pdffile"
|
||||
@click="YuLanfile(form.form.pdffile)"
|
||||
>
|
||||
{{ form.form.pdffile.split('\\').pop() }}
|
||||
</text>
|
||||
<!-- <text>{{ form.pdffile }}</text> -->
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
style="display: flex;gap: 4px;font-size: 14px;color: #666;margin-bottom: 4px;margin-top:6px;font-weight: 500;flex-direction: column;
|
||||
width: 100%;">
|
||||
<view style="width: 100%">发货地址:{{ form.place }}</view>
|
||||
<!-- <view></view> -->
|
||||
</view>
|
||||
</MBCard>
|
||||
|
||||
<view class="viewunisection">
|
||||
<uni-section>
|
||||
<view class="uni-padding-wrap uni-common-mt">
|
||||
<uni-segmented-control
|
||||
:current="current"
|
||||
:values="items"
|
||||
style-type="text"
|
||||
@clickItem="onClickItem"
|
||||
/>
|
||||
</view>
|
||||
</uni-section>
|
||||
</view>
|
||||
|
||||
<!-- 根据当前标签页显示对应的组件 -->
|
||||
<view class="tab-content">
|
||||
<!-- 商品信息 -->
|
||||
<GoodsInfo
|
||||
v-if="current === 0"
|
||||
:goods-list="goodsList"
|
||||
: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 class="action-buttons">
|
||||
<button @click="goCancel" class="btn btn-secondary">取消</button>
|
||||
<!-- <button @click="goSubmit" class="btn btn-primary">确认提交</button> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<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 { contractData, goodsData } from '../detailData.js'
|
||||
import { listsaleBusGoodsList } from '../../../../api/orderManager/index.js'
|
||||
import { listproductList,salemainDetail,businessManagerReviewGoodsList,getsalemaincheckAmount } from '../../../../api/orderManager/index.js'
|
||||
// import { getInfo } from '../../../../store/modules/user.js'
|
||||
import { useUserStore } from '../../../../store/modules/user.js'
|
||||
import { useOrderManagerStore } from '../../../../store/modules/orderManager.js'
|
||||
import data1 from './data1.js'
|
||||
import { formatPrice,YuLanfile } from "@/utils/utils.js";
|
||||
import { formatDate } from "@/uni_modules/uni-dateformat/components/uni-dateformat/date-format";
|
||||
import MBCard from "@/components/MB/MBCard.vue";
|
||||
import MBLoading from "@/components/MB/MBLoading.vue";
|
||||
|
||||
// 导入子组件
|
||||
import GoodsInfo from "@/components/SailMainComponents/OrderManagerCom/goodsListC.vue";
|
||||
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 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 current = ref(0)
|
||||
|
||||
// 标签页选项
|
||||
const items = 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]
|
||||
// console.log(contract.value)
|
||||
getEdu()
|
||||
getDeptLists()
|
||||
// GetlistsaleBusGoodsList()
|
||||
getAllData()
|
||||
// 公司名称
|
||||
const companyName = ref('')
|
||||
|
||||
// 剩余金额
|
||||
const remainingMoney = ref(0)
|
||||
|
||||
// 订单金额
|
||||
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 rowdata = useOrderManagerStore().oeders[0]
|
||||
salemainDetail(rowdata.saleid).then(res => {
|
||||
form.value = res.data
|
||||
});
|
||||
businessManagerReviewGoodsList(rowdata.saleid).then(res => {
|
||||
goodsList.value = res.data
|
||||
});
|
||||
|
||||
// 查询剩余额度
|
||||
const AmountqueryParams = {
|
||||
companyId:rowdata.companyId,
|
||||
saleId: rowdata.saleid,
|
||||
}
|
||||
getsalemaincheckAmount(AmountqueryParams).then(res => {
|
||||
remainingMoney.value = res.data.amounts
|
||||
});
|
||||
// 获取部门列表
|
||||
const getDeptLists = () => {
|
||||
return listproductList().then(res => {
|
||||
if (res.code === 200 && res.data) {
|
||||
companyOptions.value = res.data
|
||||
console.log('获取到部门列表:', companyOptions.value)
|
||||
}
|
||||
return res
|
||||
})
|
||||
}
|
||||
function GetlistsaleBusGoodsList() {
|
||||
// // 查询可销售商品列表
|
||||
const KeSaleGoodsParams = {
|
||||
companyId:form.value.companyId,
|
||||
userid: userStore.id,
|
||||
// userid: 41,
|
||||
deleteflag:0, //不禁用的,禁用标志 0: 不禁用 1: 禁用 2, 流程中
|
||||
// state:1, //状态0待审核,1已审核
|
||||
|
||||
// 获取所有数据
|
||||
const getAllData = () => {
|
||||
// 获取详情数据
|
||||
GetsalemainDetail()
|
||||
}
|
||||
|
||||
// 点击标签页
|
||||
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 = () =>{
|
||||
listproductList().then(res => {
|
||||
companyOptions.value = res.data.map(item => {
|
||||
return {
|
||||
value:item.deptId,
|
||||
text:item.deptName
|
||||
}
|
||||
})
|
||||
console.log('companyOptions.value', companyOptions.value)
|
||||
});
|
||||
|
||||
// 获取详情数据
|
||||
async function GetsalemainDetail() {
|
||||
loading.value = true
|
||||
|
||||
try {
|
||||
// 并行执行所有请求
|
||||
await Promise.all([
|
||||
getSaleMainDetail().catch(err => {
|
||||
console.error('获取订单详情失败:', err)
|
||||
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 || []
|
||||
// 处理editdate字段:提取前19个字符,将T替换为空格(精确到时分秒)
|
||||
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() {
|
||||
console.log(form.value.companyId,'form.value.companyId生产单位ID')
|
||||
// 清空已选补差数据
|
||||
const AmountqueryParams = {
|
||||
companyId:form.value.companyId,
|
||||
saleId: 0,
|
||||
const Amountform = {
|
||||
companyId: form.value.companyId,
|
||||
saleId: form.value.saleid,
|
||||
}
|
||||
|
||||
console.log('查询额度参数:', Amountform)
|
||||
|
||||
// 查询剩余额度
|
||||
getsalemaincheckAmount(AmountqueryParams).then(res => {
|
||||
remainingMoney.value = res.data.amounts
|
||||
});
|
||||
GetlistsaleBusGoodsList()
|
||||
// getsalemainpiAoKouList()
|
||||
|
||||
getsalemaincheckAmount(Amountform).then(res => {
|
||||
if (res.code === 200) {
|
||||
remainingMoney.value = res.data.amounts || 0
|
||||
console.log('获取到剩余额度:', remainingMoney.value)
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取额度失败:', error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//取消
|
||||
// 取消
|
||||
const goCancel = () => {
|
||||
|
||||
uni.navigateTo({
|
||||
url:'/pages/work/OrderManager/index'
|
||||
})
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/work/OrderManager/index'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// ::v-deep .uni-checkbox-input {
|
||||
// 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;
|
||||
<style>
|
||||
.linka{
|
||||
color: #409eff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.custom-input {
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
height: 25px;
|
||||
a, a:focus, a:hover{
|
||||
color: #409eff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.context {
|
||||
font-size: 14px;
|
||||
}
|
||||
.order-detail-container {
|
||||
padding: 16px;
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
.context .label {
|
||||
font-size: 14px;
|
||||
}
|
||||
.flex-row {
|
||||
display: flex;
|
||||
align-items: center; /* 垂直居中对齐 */
|
||||
gap: 10px; /* 标签和下拉框之间的间距 */
|
||||
.uni-section .uni-section-header__content .distraction {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.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);
|
||||
.viewunisection :deep().uni-section .uni-section-header {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 基础信息网格布局 */
|
||||
.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;
|
||||
.tab-content {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
@ -1,590 +1,223 @@
|
||||
<template>
|
||||
<view class="order-detail-container">
|
||||
<!-- 基础信息区域 -->
|
||||
|
||||
<view class="info-section">
|
||||
<uni-row class="info-grid">
|
||||
<uni-col class="flex-row">
|
||||
<view class="label">生产单位: </view>
|
||||
<uni-data-select
|
||||
v-model="form.companyId"
|
||||
:localdata="companyOptions"
|
||||
text-field="deptName"
|
||||
value-field="deptId"
|
||||
@change="getEdu"
|
||||
:clear="true"
|
||||
disabled="true"
|
||||
/>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row class="info-grid">
|
||||
<uni-col :span="12">
|
||||
<view class="label">剩余金额:{{ remainingMoney}}</view>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<view class="label">订单金额:{{ orderAmount }}</view>
|
||||
</uni-col>
|
||||
</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>
|
||||
<MBCard style="border-radius: 0;">
|
||||
<view class="" style="margin-bottom: 10px;">
|
||||
<view class="label">
|
||||
<text>生产单位:</text>
|
||||
<text>{{ companyName }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="context">
|
||||
<view class="label">
|
||||
<text>剩余金额:</text>
|
||||
<text>{{ formatPrice(remainingMoney) }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>订单金额:</text>
|
||||
<text>{{ formatPrice(orderAmount) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</MBCard>
|
||||
<uni-section class="mb-10" padding="0 0 5px 10px" title="商品信息"/>
|
||||
<MBLoading v-if="loading"/>
|
||||
<uni-card
|
||||
v-for="item in goodsList"
|
||||
:key="item.goodsname"
|
||||
:title="item.goodsname"
|
||||
>
|
||||
<view class="goods-header">
|
||||
|
||||
<text class="serial-number">{{ index + 1 }}</text>
|
||||
<text class="goods-name">{{ goods.goodsname }}</text>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<view class="goods-content">
|
||||
|
||||
<uni-row class="info-row">
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<view class="label">件装数:{{ goods.packingnum }}</view>
|
||||
</uni-col>
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<view class="label">供应参考价:{{ goods.invoiceprice }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
|
||||
<uni-row class="info-row">
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<view class="label">前三月平均数:{{ goods.threeMonths }}</view>
|
||||
</uni-col>
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<view class="label">使用票扣:{{ goods.piaokou }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
|
||||
<uni-row class="info-row">
|
||||
<uni-col :span="12" class="info-pair">
|
||||
<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 class="context">
|
||||
<view class="label">
|
||||
<text>件装数:</text>
|
||||
<text>{{ item.packingnum }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>供应参考价:</text>
|
||||
<text>{{ item.invoiceprice }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>前三月平均数:</text>
|
||||
<text>{{ formatPrice(item.mon3) }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>采购数量:</text>
|
||||
<text>{{ item.goodsnum }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>小计:</text>
|
||||
<text>{{ formatPrice(item.allmoney) }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>使用票扣:</text>
|
||||
<text>{{ formatPrice(item.piaokou) }}</text>
|
||||
</view>
|
||||
<view class="label">
|
||||
<text>税率:</text>
|
||||
<text>{{ item.taxrate }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-card>
|
||||
</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>
|
||||
|
||||
<script setup>
|
||||
import { addsalemain } from '../../../../api/orderManager/index.js'
|
||||
|
||||
import { onMounted, ref ,computed} from 'vue'
|
||||
import { contractData, goodsData } from '../detailData.js'
|
||||
import { listsaleBusGoodsList } from '../../../../api/orderManager/index.js'
|
||||
import { listproductList,salemainDetail,businessManagerReviewGoodsList,getsalemaincheckAmount } from '../../../../api/orderManager/index.js'
|
||||
// import { getInfo } from '../../../../store/modules/user.js'
|
||||
import { useUserStore } from '../../../../store/modules/user.js'
|
||||
import { useOrderManagerStore } from '../../../../store/modules/orderManager.js'
|
||||
import data1 from './data1.js'
|
||||
|
||||
//已选补差
|
||||
const selectedBuCha = ref([])
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { salemainDetail, businessManagerReviewGoodsList, getsalemaincheckAmount } from '../../../../api/orderManager/index.js'
|
||||
import { listproductList } from '../../../../api/orderManager/index.js'
|
||||
import { formatPrice } from "@/utils/utils";
|
||||
import MBCard from "@/components/MB/MBCard.vue";
|
||||
import MBLoading from "@/components/MB/MBLoading.vue";
|
||||
const loading = ref(false)
|
||||
// 商品列表数据
|
||||
const buchaGoodsList =ref([])
|
||||
const goodsList = 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 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))
|
||||
// 公司名称
|
||||
const companyName = ref('')
|
||||
// 剩余金额
|
||||
const remainingMoney = ref(0)
|
||||
// 订单金额
|
||||
const orderAmount = ref(0.00)
|
||||
// 存储参数
|
||||
const saleId = ref('')
|
||||
|
||||
onMounted(() => {
|
||||
// contract.value = contractData.data[0]
|
||||
// console.log(contract.value)
|
||||
getEdu()
|
||||
getDeptLists()
|
||||
// GetlistsaleBusGoodsList()
|
||||
getAllData()
|
||||
// 页面加载时获取参数
|
||||
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 rowdata = useOrderManagerStore().oeders[0]
|
||||
salemainDetail(rowdata.saleid).then(res => {
|
||||
form.value = res.data
|
||||
});
|
||||
businessManagerReviewGoodsList(rowdata.saleid).then(res => {
|
||||
goodsList.value = res.data
|
||||
});
|
||||
|
||||
// 查询剩余额度
|
||||
const AmountqueryParams = {
|
||||
companyId:rowdata.companyId,
|
||||
saleId: rowdata.saleid,
|
||||
}
|
||||
getsalemaincheckAmount(AmountqueryParams).then(res => {
|
||||
remainingMoney.value = res.data.amounts
|
||||
});
|
||||
// 获取部门列表
|
||||
const getDeptLists = () => {
|
||||
return listproductList().then(res => {
|
||||
if (res.code === 200 && res.data) {
|
||||
companyOptions.value = res.data
|
||||
}
|
||||
return res
|
||||
})
|
||||
}
|
||||
function GetlistsaleBusGoodsList() {
|
||||
// // 查询可销售商品列表
|
||||
const KeSaleGoodsParams = {
|
||||
companyId:form.value.companyId,
|
||||
userid: userStore.id,
|
||||
// userid: 41,
|
||||
deleteflag:0, //不禁用的,禁用标志 0: 不禁用 1: 禁用 2, 流程中
|
||||
// state:1, //状态0待审核,1已审核
|
||||
|
||||
// 获取所有数据
|
||||
const getAllData = () => {
|
||||
// 获取详情数据
|
||||
GetsalemainDetail()
|
||||
}
|
||||
|
||||
// 获取详情数据
|
||||
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 = () =>{
|
||||
listproductList().then(res => {
|
||||
companyOptions.value = res.data.map(item => {
|
||||
return {
|
||||
value:item.deptId,
|
||||
text:item.deptName
|
||||
}
|
||||
})
|
||||
console.log('companyOptions.value', companyOptions.value)
|
||||
});
|
||||
|
||||
// 计算订单金额
|
||||
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
|
||||
}
|
||||
|
||||
/** 更改生产单位时,查询额度 */
|
||||
// 查询额度
|
||||
function getEdu() {
|
||||
console.log(form.value.companyId,'form.value.companyId生产单位ID')
|
||||
// 清空已选补差数据
|
||||
const AmountqueryParams = {
|
||||
companyId:form.value.companyId,
|
||||
saleId: 0,
|
||||
companyId: form.value.companyId,
|
||||
saleId: form.value.saleid,
|
||||
}
|
||||
|
||||
// 查询剩余额度
|
||||
getsalemaincheckAmount(AmountqueryParams).then(res => {
|
||||
remainingMoney.value = res.data.amounts
|
||||
});
|
||||
GetlistsaleBusGoodsList()
|
||||
// getsalemainpiAoKouList()
|
||||
|
||||
if (res.code === 200) {
|
||||
remainingMoney.value = res.data.amounts || 0
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取额度失败:', error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//取消
|
||||
// 取消
|
||||
const goCancel = () => {
|
||||
|
||||
uni.navigateTo({
|
||||
url:'/pages/work/OrderManager/index'
|
||||
})
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/work/OrderManager/index'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// ::v-deep .uni-checkbox-input {
|
||||
// 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;
|
||||
<style>
|
||||
.context{
|
||||
font-size: 14px;
|
||||
}
|
||||
.custom-input {
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
height: 25px;
|
||||
}
|
||||
.order-detail-container {
|
||||
padding: 16px;
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.flex-row {
|
||||
display: flex;
|
||||
align-items: center; /* 垂直居中对齐 */
|
||||
gap: 10px; /* 标签和下拉框之间的间距 */
|
||||
}
|
||||
.context .label{
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
|
||||
.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>
|
||||
@ -170,7 +170,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品列表操作按钮 -->
|
||||
<view class="action-buttons ">
|
||||
<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 { useUserStore } from '@/store'
|
||||
import MBLoading from "@/components/MB/MBLoading.vue";
|
||||
import data1 from './data1.js'
|
||||
const userStore = useUserStore()
|
||||
const userID = ref(userStore.id)
|
||||
const loading = ref(true)
|
||||
@ -211,6 +209,7 @@ const tempSelectedItems = ref([]) // 临时选中的补差项
|
||||
const companyOptions = ref([])
|
||||
const isInitializing = ref(false)
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
isInitializing.value = true
|
||||
try {
|
||||
@ -321,7 +320,6 @@ function getEdu() {
|
||||
} else {
|
||||
remainingMoney.value = 0
|
||||
}
|
||||
|
||||
GetlistsaleBusGoodsList()
|
||||
getsalemainpiAoKouList()
|
||||
})
|
||||
|
||||
@ -1,122 +1,119 @@
|
||||
// buchadata.js
|
||||
export default {
|
||||
data: [
|
||||
{
|
||||
piaokouid: 1,
|
||||
goodsid: 1, // 对应盐酸丙卡特罗片(美普清)10
|
||||
applydate: "2024-01-15",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "MPT10",
|
||||
goodsname: "盐酸丙卡特罗片(美普清)10",
|
||||
piaokou: 100
|
||||
},
|
||||
{
|
||||
piaokouid: 101,
|
||||
goodsid: 1, // 对应盐酸丙卡特罗片(美普清)10
|
||||
applydate: "2025-11-15",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "MPT10",
|
||||
goodsname: "盐酸丙卡特罗片(美普清)10",
|
||||
piaokou: 200
|
||||
},
|
||||
{
|
||||
piaokouid: 2,
|
||||
goodsid: 3, // 对应盐酸丙卡特罗片(美普清)20
|
||||
applydate: "2024-01-16",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "MPT20",
|
||||
goodsname: "盐酸丙卡特罗片(美普清)20",
|
||||
piaokou: 10000.01
|
||||
},
|
||||
{
|
||||
piaokouid: 102,
|
||||
goodsid: 3, // 对应盐酸丙卡特罗片(美普清)20
|
||||
applydate: "2024-01-17",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "MPT20",
|
||||
goodsname: "盐酸丙卡特罗片(美普清)20",
|
||||
piaokou: 20000.02
|
||||
},
|
||||
{
|
||||
piaokouid: 3,
|
||||
goodsid: 5, // 对应瑞巴派特片(膜固思达)24
|
||||
applydate: "2024-01-17",
|
||||
piaokoutype: "促销补差",
|
||||
shortname: "MCT24",
|
||||
goodsname: "瑞巴派特片(膜固思达)24",
|
||||
piaokou: 12.80
|
||||
},
|
||||
{
|
||||
piaokouid: 4,
|
||||
goodsid: 35, // 对应瑞巴派特片(膜固思达)48
|
||||
applydate: "2024-01-18",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "MCT48",
|
||||
goodsname: "瑞巴派特片(膜固思达)48",
|
||||
piaokou: 25.00
|
||||
},
|
||||
{
|
||||
piaokouid: 5,
|
||||
goodsid: 6, // 对应阿立哌唑片(安律凡)5mg
|
||||
applydate: "2024-01-19",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "ABF5",
|
||||
goodsname: "阿立哌唑片(安律凡)5mg",
|
||||
piaokou: 18.50
|
||||
},
|
||||
{
|
||||
piaokouid: 6,
|
||||
goodsid: 8, // 对应托伐普坦片(苏麦卡)
|
||||
applydate: "2024-01-20",
|
||||
piaokoutype: "促销补差",
|
||||
shortname: "SMC",
|
||||
goodsname: "托伐普坦片(苏麦卡)",
|
||||
piaokou: 45.75
|
||||
},
|
||||
{
|
||||
piaokouid: 7,
|
||||
goodsid: 10, // 对应白消安注射液(白舒非)
|
||||
applydate: "2024-01-21",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "BSF",
|
||||
goodsname: "白消安注射液(白舒非)",
|
||||
piaokou: 120.25
|
||||
},
|
||||
{
|
||||
piaokouid: 8,
|
||||
goodsid: 33, // 对应德拉马尼片(德尔巴)
|
||||
applydate: "2024-01-22",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "DLM",
|
||||
goodsname: "德拉马尼片(德尔巴)",
|
||||
piaokou: 280.00
|
||||
},
|
||||
{
|
||||
piaokouid: 9,
|
||||
goodsid: 39, // 对应注射用阿立哌唑0.4g
|
||||
applydate: "2024-01-23",
|
||||
piaokoutype: "促销补差",
|
||||
shortname: "AOM400",
|
||||
goodsname: "注射用阿立哌唑0.4g",
|
||||
piaokou: 95.90
|
||||
},
|
||||
{
|
||||
piaokouid: 10,
|
||||
goodsid: 41, // 对应布瑞哌唑片(锐思定)1mg
|
||||
applydate: "2024-01-24",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "RXT1",
|
||||
goodsname: "布瑞哌唑片(锐思定)1mg",
|
||||
piaokou: 22.40
|
||||
},
|
||||
{
|
||||
piaokouid: 11,
|
||||
goodsid: 42, // 对应泊那替尼片(英可欣)15mg
|
||||
applydate: "2024-01-25",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "ISG",
|
||||
goodsname: "泊那替尼片(英可欣)15mg",
|
||||
piaokou: 350.60
|
||||
}
|
||||
]
|
||||
};
|
||||
data: [{
|
||||
piaokouid: 1,
|
||||
goodsid: 1, // 对应盐酸丙卡特罗片(美普清)10
|
||||
applydate: "2024-01-15",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "MPT10",
|
||||
goodsname: "盐酸丙卡特罗片(美普清)10",
|
||||
piaokou: 100
|
||||
},
|
||||
{
|
||||
piaokouid: 101,
|
||||
goodsid: 1, // 对应盐酸丙卡特罗片(美普清)10
|
||||
applydate: "2025-11-15",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "MPT10",
|
||||
goodsname: "盐酸丙卡特罗片(美普清)10",
|
||||
piaokou: 200
|
||||
},
|
||||
{
|
||||
piaokouid: 2,
|
||||
goodsid: 3, // 对应盐酸丙卡特罗片(美普清)20
|
||||
applydate: "2024-01-16",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "MPT20",
|
||||
goodsname: "盐酸丙卡特罗片(美普清)20",
|
||||
piaokou: 10000.01
|
||||
},
|
||||
{
|
||||
piaokouid: 102,
|
||||
goodsid: 3, // 对应盐酸丙卡特罗片(美普清)20
|
||||
applydate: "2024-01-17",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "MPT20",
|
||||
goodsname: "盐酸丙卡特罗片(美普清)20",
|
||||
piaokou: 20000.02
|
||||
},
|
||||
{
|
||||
piaokouid: 3,
|
||||
goodsid: 5, // 对应瑞巴派特片(膜固思达)24
|
||||
applydate: "2024-01-17",
|
||||
piaokoutype: "促销补差",
|
||||
shortname: "MCT24",
|
||||
goodsname: "瑞巴派特片(膜固思达)24",
|
||||
piaokou: 12.80
|
||||
},
|
||||
{
|
||||
piaokouid: 4,
|
||||
goodsid: 35, // 对应瑞巴派特片(膜固思达)48
|
||||
applydate: "2024-01-18",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "MCT48",
|
||||
goodsname: "瑞巴派特片(膜固思达)48",
|
||||
piaokou: 25.00
|
||||
},
|
||||
{
|
||||
piaokouid: 5,
|
||||
goodsid: 6, // 对应阿立哌唑片(安律凡)5mg
|
||||
applydate: "2024-01-19",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "ABF5",
|
||||
goodsname: "阿立哌唑片(安律凡)5mg",
|
||||
piaokou: 18.50
|
||||
},
|
||||
{
|
||||
piaokouid: 6,
|
||||
goodsid: 8, // 对应托伐普坦片(苏麦卡)
|
||||
applydate: "2024-01-20",
|
||||
piaokoutype: "促销补差",
|
||||
shortname: "SMC",
|
||||
goodsname: "托伐普坦片(苏麦卡)",
|
||||
piaokou: 45.75
|
||||
},
|
||||
{
|
||||
piaokouid: 7,
|
||||
goodsid: 10, // 对应白消安注射液(白舒非)
|
||||
applydate: "2024-01-21",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "BSF",
|
||||
goodsname: "白消安注射液(白舒非)",
|
||||
piaokou: 120.25
|
||||
},
|
||||
{
|
||||
piaokouid: 8,
|
||||
goodsid: 33, // 对应德拉马尼片(德尔巴)
|
||||
applydate: "2024-01-22",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "DLM",
|
||||
goodsname: "德拉马尼片(德尔巴)",
|
||||
piaokou: 280.00
|
||||
},
|
||||
{
|
||||
piaokouid: 9,
|
||||
goodsid: 39, // 对应注射用阿立哌唑0.4g
|
||||
applydate: "2024-01-23",
|
||||
piaokoutype: "促销补差",
|
||||
shortname: "AOM400",
|
||||
goodsname: "注射用阿立哌唑0.4g",
|
||||
piaokou: 95.90
|
||||
},
|
||||
{
|
||||
piaokouid: 10,
|
||||
goodsid: 41, // 对应布瑞哌唑片(锐思定)1mg
|
||||
applydate: "2024-01-24",
|
||||
piaokoutype: "价格补差",
|
||||
shortname: "RXT1",
|
||||
goodsname: "布瑞哌唑片(锐思定)1mg",
|
||||
piaokou: 22.40
|
||||
},
|
||||
{
|
||||
piaokouid: 11,
|
||||
goodsid: 42, // 对应泊那替尼片(英可欣)15mg
|
||||
applydate: "2024-01-25",
|
||||
piaokoutype: "运费补差",
|
||||
shortname: "ISG",
|
||||
goodsname: "泊那替尼片(英可欣)15mg",
|
||||
piaokou: 350.60
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
<uni-forms ref="baseForm" :modelValue="queryParams">
|
||||
<uni-forms-item label="货主">
|
||||
<uni-data-select
|
||||
v-model="queryParams.CompanyId"
|
||||
v-model="queryParams.companyId"
|
||||
:clear="true"
|
||||
:localdata="companyOptions"
|
||||
text-field="deptName"
|
||||
|
||||
542
utils/utils.js
542
utils/utils.js
@ -1,3 +1,545 @@
|
||||
export const formatPrice = (value) => {
|
||||
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';
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user