123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783 |
- <template>
- <div>
- <detail-template
- :headData="mainAreaData"
- :title="'订单号:'+orderData.sonum"
- :tabs="['订单明细','订单进度','发货单','收支明细','出库单','物流单']"
- :delParam="{id:'20221108152102',content:{sa_orderids:[router.currentRoute.value.query.id]}}"
- ownertable="sa_order"
- :disable="utils.isDisabled(orderData.status,[],(orderData.status !== '新建'))"
- >
- <template #operation>
- <a-space>
- <abstract v-if="utils.hasPermission('abstract')" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='审核'))" :data="orderData" @onSuccess="mianData"></abstract>
- <a-button v-if="canPrintBoolean" type="primary" size="mini" @click="printData">打印</a-button>
- <edit v-if="utils.hasPermission('update')" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='新建'))" :data="orderData" @onSuccess="mianData"></edit>
- <a-space v-if="utils.isDisabled(orderData.status,[''],(orderData.type =='特殊订单'))">
- <a-button v-if="utils.hasPermission('preSubmissionBack')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='预提交'))" @click="onSpcialSubmit(20230331152503,'预提交撤回',false)">预提撤回</a-button>
- <a-button v-if="utils.hasPermission('preSubmissionConfirm')" type="primary" :disabled="utils.isDisabled(orderData.status,['提交','审核','确认','关闭','手工关闭'])" @click="onSpcialSubmit(20230331102503,'预提交确认',true)">预提交确认</a-button>
- <a-button v-if="utils.hasPermission('preSubmissionConfirmBack')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='确认'))" @click="onSpcialSubmit(20230331102503,'反确认',false)">反确认</a-button>
- </a-space>
- <a-button v-if="utils.hasPermission('submit')" :disabled="utils.isDisabled(orderData.status,[''],canSubmit)" type="primary" size="mini" @click="onSubmit('提交')">提 交</a-button>
- <returnBill :data="orderData" :enddate="enddate" :disabled="utils.isDisabled(orderData.status,['新建','预提交','确认','审核','关闭','手工关闭'])" @onSuccess="mianData"></returnBill>
- <a-button v-if="utils.hasPermission('examine')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='提交'))" @click="checkBill(20221108153502,'审核')">审核</a-button>
- <a-button v-if="utils.hasPermission('unExamine')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='审核'))" @click="checkBill(20230102141502,'反审核')">反审核</a-button>
- <a-button v-if="utils.hasPermission('cancel')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !== '审核'))" @click="checkBill(20230406155202,'手工关闭')">关闭</a-button>
- <a-button v-if="utils.hasPermission('copy')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.type === '促销订单'))">
- <selectEnterprise :disabled="utils.isDisabled(orderData.status,[''],(orderData.type === '促销订单'))" :param="{id:20230219195002,content:{ismanage :1,pageNumber:1,pageSize:20,where:{condition:''}}}" @onSelect="copyOrder">
- <template #text>复制</template>
- </selectEnterprise>
- </a-button>
- </a-space>
- </template>
- <template v-if="orderData.sa_accountclassinfos" #customContent>
- <a-divider orientation="left" orientation-margin="0px"><span class="almm">支付信息</span></a-divider>
- <div class="account-item-panel" v-for="item in orderData.sa_accountclassinfos" :key="item.index">
- <div class="account-item-panel-content">
- <p style="color:red;font-weight: bold;">{{item.accountname}}</p><a-divider type="vertical" />
- <p>实时余额: ¥<span class="accountAmount">{{utils.formatAmount(item.realbalance,{name:'hideFields',key:'realbalance'})}}</span></p><a-divider type="vertical" />
- <p>当时余额: ¥<span class="accountAmount">{{utils.formatAmount(item.balance,{name:'hideFields',key:'balance'})}}</span></p><a-divider type="vertical" />
- <p>信用额度: ¥{{utils.formatAmount(item.creditquota,{name:'hideFields',key:'creditquota'})}}</p><a-divider type="vertical" />
- <div>本单支出: <span style="color:red">¥{{utils.formatAmount(item.amount,{name:'hideFields',key:'amount'})}}</span></div>
- </div>
- </div>
- </template>
- <template #tab0>
- <normalTable :tableRowStyle="formatter" rowKey="sa_orderitemsid" ref="prodlist" :columns="utils.TBLayout('orderMxTable')" :tableid="utils.TBLayoutID('orderMxTable')" tableName="orderMxTable" size="small" :param="param" @onSelect="onSelectChange">
- <template v-if="utils.hasPermission('orderMxedit')" #operation>
- <a-space class="mt-10">
- <a-button :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭','手工关闭'])" :type="isEditDisabled?'primary':'dashed'" @click="editRowProd">{{isEditDisabled?'行编辑':'保存'}}</a-button>
- <tableImport :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭','手工关闭'])" :bindData="{ownerid:router.currentRoute.value.query.id,ownertable:'sa_order',usetype:'default'}" :failedData="failedData" :modeParam="{id:20230227194703,content:{}}" @uploadSuccess="importSuccess">
- </tableImport>
- <select-product :columns="utils.TBLayout('orderAddTable')" :tableid="utils.TBLayoutID('orderAddTable')" :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭',,'手工关闭'])" :param="{id:20221109153502,content:{sa_orderid:orderData.sa_orderid,pageNumber:1,pageSize:20,where:{condition:''}}}" @onSelectChange="addProductToBody">
- <template #tb_cell="{data}">
- <template v-if="data.column.dataIndex === 'qty'">
- <a-input-number style="width:100%" id="inputNumber" :precision="2" v-model:value="data.record.qty" :min="data.record.orderminqty" :step="data.record.orderaddqty"/>
- </template>
- <!-- <template v-if="data.column.dataIndex === 'length' && data.record.iscustomsize == 1">
- <a-select v-if="data.record.lengthschemedetails.length > 0" v-model:value="data.record.length" style="width: 150px" placeholder="选择长度">
- <a-select-option v-for="item in data.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
- </a-select>
- <a-input v-else style="width:200px;" v-model:value="data.record.length" :placeholder="`输入${data.record.lengthmin}到${data.record.lengthmax}长度`" @blur="validInput(data.record,data.record.lengthmin,data.record.lengthmax,'length')">
- </a-input>
- </template> -->
- <template v-if="data.column.dataIndex === 'iscustom' && data.record.iscustomsize == 1">
- <a-button type="link" @click="openCustom(data)" v-if="!data.record.isselect">定制信息</a-button>
- <a-tag v-else closable @close="closeInfo(data.record)">{{ infoFun(data.record) }}</a-tag>
- </template>
- <!-- <template v-if="data.column.dataIndex === 'width' && data.record.iscustomsize == 1">
- <a-select v-if="data.record.widthschemedetails.length > 0" v-model:value="data.record.width" style="width: 150px" placeholder="选择宽度">
- <a-select-option v-for="item in data.record.widthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
- </a-select>
- <a-input v-else style="width:200px;" v-model:value="data.record.width" :placeholder="`输入${data.record.widthmin}到${data.record.widthmax}宽度`" @blur="validInput(data.record,data.record.widthmin,data.record.widthmax,'width')">
- </a-input>
- </template> -->
- <template v-if="data.column.dataIndex === 'remarks'">
- <a-tooltip>
- <template #title>{{data.record.remarks}}</template>
- <a-input style="width:100%" v-model:value="data.record.remarks" :min="1" @change="inputChange(data.record,'remarks')"/>
- </a-tooltip>
- </template>
- </template>
- </select-product>
- <a-button :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭','手工关闭'],(selectProductList.length == 0))" type="primary" @click="deleteProd">删除商品</a-button>
- <order-discount :id="router.currentRoute.value.query.id" :data="selectProductList" :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭','手工关闭'])" @onSuccess="onSuccess"></order-discount>
- <a-button :disabled="utils.isDisabled(orderData.status,['新建','确认','提交','关闭','手工关闭'],(selectProductList.length == 0))" type="primary" @click="quickSendProduct">一键发货</a-button>
- <a-button :disabled="utils.isDisabled(orderData.status,['新建','确认','提交','关闭','手工关闭'],(selectProductList.length == 0))" type="primary" @click="freezeRows(true)">行冻结</a-button>
- <a-button :disabled="utils.isDisabled(orderData.status,['新建','确认','提交','关闭','手工关闭'],(selectProductList.length == 0))" type="primary" @click="freezeRows(false)">解冻行</a-button>
- <!-- <hasSelected :columns="utils.TBLayout('orderMxTable')"></hasSelected> -->
- </a-space>
- </template>
- <template v-if="utils.hasPermission('orderMxedit')" #tb_cell="{data}">
- <template v-if="data.column.dataIndex === 'qty'">
- <a-input-number v-if="orderData.type == '特殊订单'" v-model:value="data.record.qty" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)" @change="inputChange(data.record,'qty')"></a-input-number>
- <a-input-number v-else v-model:value="data.record.qty" :precision="2" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)" :min="data.record.orderminqty" :step="data.record.orderaddqty" @change="inputChange(data.record,'qty')"></a-input-number>
- </template>
- <template v-if="data.column.dataIndex === 'price'">
- <a-input v-if="canEdit" v-model:value="data.record.price" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)" @change="inputChange(data.record,'price')"></a-input>
- </template>
- <template v-if="data.column.dataIndex === 'amount'">
- <a-input v-if="canEdit" v-model:value="data.record.amount" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)" @change="inputChange(data.record,'amount')"></a-input>
- </template>
- <template v-if="data.column.dataIndex === 'remarks'">
- <a-tooltip>
- <template #title>{{data.record.remarks}}</template>
- <a-input style="width:100%" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)" v-model:value="data.record.remarks" :min="1" @change="inputChange(data.record,'remarks')"/>
- </a-tooltip>
- </template>
- </template>
- </normalTable>
- </template>
- <template #tab1>
- <od-progress></od-progress>
- </template>
- <template #tab2>
- <dispatch-temp></dispatch-temp>
- </template>
- <template #tab3>
- <income-mx></income-mx>
- </template>
- <template #tab4>
- <sale-out-bill></sale-out-bill>
- </template>
- <template #tab5>
- <logistics-order></logistics-order>
- </template>
- </detail-template>
- <print ref="printRef" :list="reportList" @onModeClick="onModeClick"></print>
- <a-modal v-model:open="open" wrapClassName="oder-modal" title="定制信息" @ok="handleOk" style="text-align:left" :closable="false">
- <div class="mt-10" style="display: flex;justify-content: space-evenly;margin-top: 20px;">
- <div style="display: flex;align-items: center;color: red;">
- <span class="label">品号:{{prod.record.itemno}}</span>
- <span class="label overflow" style="max-width: 220px;margin-left: 10px;">品名:
- <a-tooltip placement="topLeft" :title="prod.record.itemname" arrow-point-at-center>
- {{prod.record.itemname}}
- </a-tooltip>
- </span>
- </div>
- </div>
- <div class="mt-10" v-if="prod.record.cheekschemeid > 0">
- <span class="label">工艺</span>
- <a-select v-model:value="prod.record.customcheek" style="width: 400px;" placeholder="选择工艺">
- <a-select-option v-for="item in prod.record.cheekschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
- </a-select>
- </div>
- <div class="mt-10" v-if="prod.record.colorschemeid > 0">
- <span class="label">颜色</span>
- <a-select v-model:value="prod.record.customcolors" style="width: 400px" placeholder="选择颜色">
- <a-select-option v-for="item in prod.record.colorsschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
- </a-select>
- </div>
- <div class="mt-10" v-if="prod.record.materialschemeid > 0">
- <span class="label">选项</span>
- <a-select v-model:value="prod.record.custommaterial" style="width: 400px" placeholder="选择选项">
- <a-select-option v-for="item in prod.record.materialschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
- </a-select>
- </div>
- <div class="mt-10" v-if="prod.record.spec == '自定义' || prod.record.spec == 'custom'">
- <span class="label">长度</span>
- <a-select v-if="prod.record.lengthschemedetails.length > 0" v-model:value="prod.record.length" style="width: 400px" placeholder="选择长度">
- <a-select-option v-for="item in prod.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
- </a-select>
- <a-input v-else style="width:400px;" v-model:value="prod.record.length" :placeholder="`输入${prod.record.lengthmin}到${prod.record.lengthmax}毫米`" @blur="validInput(prod.record,prod.record.lengthmin,prod.record.lengthmax,'length')">
- </a-input>
- </div>
- <div class="mt-10" v-if="prod.record.spec == '自定义' || prod.record.spec == 'custom'">
- <span class="label">宽度</span>
- <a-select v-if="prod.record.widthschemedetails.length > 0" v-model:value="prod.record.width" style="width: 400px" placeholder="选择宽度">
- <a-select-option v-for="item in prod.record.widthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
- </a-select>
- <a-input v-else style="width:400px;" v-model:value="prod.record.width" :placeholder="`输入${prod.record.widthmin}到${prod.record.widthmax}毫米`" @blur="validInput(prod.record,prod.record.widthmin,prod.record.widthmax,'width')">
- </a-input>
- </div>
- </a-modal>
- </div>
- </template>
- <script setup>
- import Api from '@/api/api'
- import utils from '@/utils/utils'
- import orderDiscount from './modules/orderDiscount.vue'
- import normalTable from '@/template/normalTable/index.vue'
- import tableImport from '@/components/tableImport/index.vue'
- import hasSelected from '@/template/hasTableSelect/index.vue'
- import SelectProduct from '@/template/selectProduct/index.vue'
- import selectEnterprise from '@/template/selectEnterprise/index.vue'
- import detailTemplate from '@/components/detailTemplate/index.vue'
- import abstract from './modules/abstract.vue'
- import edit from './modules/edit.vue'
- import returnBill from './modules/returnBill.vue'
- import OdProgress from './tabs/progress.vue'
- import DispatchTemp from './tabs/dispatch.vue'
- import saleOutBill from './tabs/saleOutBill.vue'
- import logisticsOrder from './tabs/logisticsOrder.vue'
- import IncomeMx from './tabs/income.vue'
- import print from '@/components/print/index.vue'
- import { Modal } from 'ant-design-vue'
- import { message } from 'ant-design-vue';
- import { storeToRefs } from 'pinia'
- import { useAuthStore } from '@/stores/modules/auth'
- import { useBaseStore } from '@/stores/modules/base'
- import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
- import { useRouter } from "vue-router";
- import { onMounted,ref,createVNode,computed,onBeforeUnmount } from "vue";
- const store = useAuthStore()
- const base = useBaseStore()
- let { app } = storeToRefs(store)
- const router = useRouter()
- const mainAreaData = ref([])
- const current = ref(0)
- const isEditDisabled = ref(true)
- const param = ref({
- "id": 20221109093902,
- "content": {
- "nocache":true,
- "sa_orderid": router.currentRoute.value.query.id, //订单ID
- "pageNumber": 1,
- "pageSize": 20,
- "where": {
- "condition": ""
- }
- },
- })
- const canSubmit = computed(()=>{
- if (orderData.value.type == '特殊订单' && orderData.value.status !=='确认') {
- return true
- }
- if (orderData.value.type == '标准订单' && orderData.value.status !== '新建') {
- return true
- }
- if (orderData.value.type == '促销订单' && orderData.value.status !== '新建') {
- return true
- }
- })
- const canEdit = computed(()=>{
- if (orderData.value.type == '特殊订单') {
- return true
- } else {
- return false
- }
- })
- const orderData = ref({})
- const mianData = async (...args)=>{
- const res = await Api.requested({
- "id":'20221108151302',
- "content": {
- "nocache":true,
- "sa_orderid":router.currentRoute.value.query.id,
- }
- })
- orderData.value = res.data
- changeDataStructure(res.data)
- if (orderData.value.type == '促销订单') {
- promotion()
- }
- }
- const changeDataStructure = (data) => {
- mainAreaData.value = utils.FormLayout('orderBillHead',data)
- if (data.type === '促销订单') {
- mainAreaData.value.splice(0,0,{
- label:'活动名称',
- value:data.promname,
- span:4
- })
- mainAreaData.value.splice(1,0,{
- label:'方案编码',
- value:data.promnum,
- span:2
- })
- }
- }
- const selectProductList = ref([])
- const onSelectChange = (val) =>{
- selectProductList.value = val
- }
- const prodlist = ref()
- const hasChangeData = ref([])
- const inputChange = (val,type) =>{
- switch (type){
- case 'qty':
- val.amount = val.qty * val.price
- break;
- case 'price':
- val.amount = val.qty * val.price
- break;
- case 'amount':
- val.price = val.amount / val.qty
- break;
- default:
- break;
- }
- if (hasChangeData.value.some(e=>e.sa_orderitemsid == val.sa_orderitemsid)) {
- hasChangeData.value.filter(e=>{
- if (e.sa_orderitemsid == val.sa_orderitemsid) {
- e = val
- return false
- }
- })
- } else {
- hasChangeData.value = [...hasChangeData.value,...[val]]
- }
- }
- const editRowProd = ()=>{
- if (isEditDisabled.value) {
- base.saveBillChangeData({
- udid:20221109093602,
- ndid:[20221109153502,20221108153402,20230331152503,20230331102503,20230102144502],
- editing:true,
- fn:()=>{
- updateProd(hasChangeData.value,'修改成功',()=>{
- hasChangeData.value = []
- isEditDisabled.value = true
- })
- }
- })
- isEditDisabled.value = false
- return isEditDisabled.value
- }
- if (hasChangeData.value.length == 0) {
- isEditDisabled.value = true
- base.saveBillChangeData({editing:false})
- } else {
- updateProd(hasChangeData.value,'修改成功',()=>{
- hasChangeData.value = []
- isEditDisabled.value = true
- })
- base.saveBillChangeData({editing:false})
- }
- }
- const updateProd = async (data,msg,fn) =>{
- const res = await Api.post({
- id:20221109093602,
- content:{
- sa_orderid:orderData.value.sa_orderid,
- sys_enterpriseid:orderData.value.sys_enterpriseid,
- type:orderData.value.type,
- sa_order_v:orderData.value.sa_order_v,
- sa_contractid: orderData.value.sa_contractid,
- items:data.map(e=>{
- return {
- sa_orderitemsid:e.sa_orderitemsid,
- itemid:e.itemid,
- qty:e.qty,
- price:e.price,
- amount:0,
- sa_orderitems_v:e.sa_orderitems_v,
- defaultprice:e.defaultprice,
- remarks:e.remarks,
- length:e.length ? e.length:0,
- width:e.width ? e.width:0,
- sa_promotion_itemsid:e.sa_promotion_itemsid,
- customcolors:e.customcolors ? e.customcolors:0,
- customcheek:e.customcheek ? e.customcheek:0,
- custommaterial:e.custommaterial ? e.custommaterial:0
- }
- })
- }
- })
- utils.message(res,msg,()=>{
- mianData()
- prodlist.value.listData()
- fn ? fn(): ''
- })
-
- }
- const validInput = async (record,min,max,type)=>{
- if (!record[type]) return
- if (record[type] > max) {
- record[type] = max
- } else if (record[type] < min) {
- record[type] = min
- } else {
- record[type] = record[type]
- }
- }
- const addProductToBody = async (val) =>{
- let param = {
- "id": 2024020201095102,
- "content": {
- "sa_orderid": orderData.value.sa_orderid,
- "sys_enterpriseid": orderData.value.sys_enterpriseid,
- "type":orderData.value.type,
- "sa_contractid": 0,
- "items":val
- }
- }
- base.addRepeatProd(param).then((res)=>{
- let ald = true
- const allowAdd = (e)=>{
- if (e.iscustomsize == 1) {
- if (!e.length || !e.width) {
- message.error({content:`${e.itemname}定制信息有误,请检查!`,key:2})
- ald = false
- } else if (e.cheekschemeid > 0 && !e.customcheek) {
- message.error({content:e.itemname + '工艺定制信息有误,请检查!',key:2})
- ald = false
- } else if (e.colorschemeid > 0 && !e.customcolors) {
- message.error({content:e.itemname + '颜色定制信息有误,请检查!',key:2})
- ald = false
- } else if (e.materialschemeid > 0 && !e.custommaterial) {
- message.error({content:e.itemname + '选项定制信息有误,请检查!',key:2})
- ald = false
- } else {
- return {
- sa_orderitemsid:0,
- itemid:e.itemid,
- qty:e.qty,
- length:e.length ? e.length:0,
- remarks:e.remarks,
- width:e.width ? e.width:0,
- customcolors:e.customcolors ? e.customcolors:0,
- customcheek:e.customcheek ? e.customcheek:0,
- custommaterial:e.custommaterial ? e.custommaterial:0
- }
- }
- } else {
- return {
- sa_orderitemsid:0,
- itemid:e.itemid,
- qty:e.qty,
- length:0,
- width:0,
- remarks:e.remarks,
- }
- }
- }
- let data = val.map(e=>{
- return allowAdd(e)
- })
- if (!ald) return false
- data.filter(e=>e !== undefined).length > 0 ? updateProd(data.filter(e=>e !== undefined),'添加成功',()=>{
- prodlist.value.tableRecord = []
- }):''
- })
- }
- const deleteProd = ()=>{
- Modal.confirm({
- title: '删除商品',
- icon: createVNode(ExclamationCircleOutlined),
- content: `当前选中${selectProductList.value.length}个商品,删除${selectProductList.value.length}个商品!`,
- okText: '确认',
- cancelText: '取消',
- async onOk() {
- const res = await Api.post({
- id:20221109093702,
- content:{
- sa_orderid:orderData.value.sa_orderid,
- sa_orderitemsids:selectProductList.value.map(e=>{
- return e.sa_orderitemsid
- })
- }
- })
- utils.message(res,'删除成功',()=>{
- prodlist.value.reloadSelect()
- selectProductList.value = []
- prodlist.value.listData()
- mianData()
- })
- },
- onCancel() {},
- })
- }
- const onSuccess = ()=>{
- prodlist.value.listData()
- }
- const onSpcialSubmit = async (id,msg,value)=>{
- Modal.confirm({
- title: '提示',
- icon: createVNode(ExclamationCircleOutlined),
- content: `确定${msg}该订单吗!`,
- okText: '确认',
- cancelText: '取消',
- async onOk() {
- const res = await Api.post({
- id:id,
- content:{
- "sa_orderid": orderData.value.sa_orderid,
- "isrecheck":value
- }
- })
- utils.message(res,msg + '成功',()=>{
- mianData()
- })
- },
- onCancel() {},
- })
- }
- const checkBill = async (id,msg)=>{
- Modal.confirm({
- title: '提示',
- icon: createVNode(ExclamationCircleOutlined),
- content: `确定${msg}该订单吗?`,
- okText: '确认',
- cancelText: '取消',
- async onOk() {
- const res = await Api.post({
- id:id,
- content:{
- "sa_orderid": orderData.value.sa_orderid,
- "reviewtype":''
- }
- })
- utils.message(res,`${msg}成功`,()=>{
- mianData()
- })
- },
- onCancel() {},
- })
- }
- const zero_price = ref(false)
- const onSubmit = async (id,msg)=>{
- if (orderData.value.type == '特殊订单') {
- const rs = await Api.requested({
- id:2024060515370903,
- content:{
- "sa_orderid": orderData.value.sa_orderid,
- }
- })
- if (rs.data.length > 0) {
- zero_price.value = true
- }
- }
-
- Modal.confirm({
- title: '提示',
- icon: createVNode(ExclamationCircleOutlined),
- content:zero_price.value?'存在单价为0的商品,是否继续提交?':`确定提交该订单吗?`,
- okText: '确认',
- cancelText: '取消',
- async onOk() {
- const res = await Api.post({
- id:20221108153402,
- content:{
- "sa_orderid": orderData.value.sa_orderid,
- "reviewtype":''
- }
- })
- utils.message(res,`提交成功`,()=>{
- mianData()
- })
- },
- onCancel() {},
- })
- }
- const quickSendProduct = ()=>{
- Modal.confirm({
- title: '一键发货',
- icon: createVNode(ExclamationCircleOutlined),
- content: `当前选中${selectProductList.value.length}个商品!`,
- okText: '确认',
- cancelText: '取消',
- async onOk() {
- const res = await Api.post({
- id:20230220100604,
- content:{
- sa_orderid:orderData.value.sa_orderid,
- sa_orderitemsids:selectProductList.value.map(e=>{
- return e.sa_orderitemsid
- })
- }
- })
- utils.message(res,'创建成功',()=>{
- prodlist.value.reloadSelect()
- selectProductList.value = []
- router.push({path:'/dispatchDetail',query:{id:res.data.sa_dispatchid}})
- })
- },
- onCancel() {},
- })
- }
- const formatter = (_record, index) => {
- if (_record.undeliqty > 0 && orderData.value.status == '审核') {
- return 'table-striped-red'
- } else {
- return null
- }
- }
- /**
- * 获取促销订单方案详情
- */
- const enddate = ref('')
- const promotion = async () =>{
- const res = await Api.requested({
- id:20221230144703,
- content:{
- nocache:true,
- sa_promotionid:orderData.value.sa_promotionid
- }
- })
- enddate.value = res.data.enddate
- }
- const freezeRows = (bool)=>{
- if (bool && selectProductList.value.some(e=>e.isfreeze == 1)) {
- return message.error('存在已经冻结的行数据,请重新选择!')
- }
- if (!bool && selectProductList.value.some(e=>e.isfreeze == 0)) {
- return message.error('存在未冻结的行数据,请重新选择!')
- }
- Modal.confirm({
- title: '是否冻结行',
- icon: createVNode(ExclamationCircleOutlined),
- content: `当前选中${selectProductList.value.length}行!`,
- okText: '确认',
- cancelText: '取消',
- async onOk() {
- const res = await Api.post({
- id:20230508093003,
- content:{
- isfreeze:bool,
- sa_orderid:orderData.value.sa_orderid,
- sa_orderitemsids:selectProductList.value.map(e=>{
- return e.sa_orderitemsid
- })
- }
- })
- utils.message(res,`${bool?'冻结':'解冻'}成功`,()=>{
- prodlist.value.reloadSelect()
- selectProductList.value = []
- prodlist.value.listData()
- })
- },
- onCancel() {},
- })
- }
- const copyOrder = async (val)=>{
- const res = await Api.requested({
- id:20230102144502,
- content:{
- sa_orderid:orderData.value.sa_orderid,
- sys_enterpriseid:val.sys_enterpriseid
- }
- })
- utils.message(res,'复制成功',()=>{
- Modal.confirm({
- title: '提示',
- icon: createVNode(ExclamationCircleOutlined),
- content: `是否跳转到新订单?`,
- okText: '确认',
- cancelText: '取消',
- async onOk() {
- router.replace({path:'/orderdetail',query:{id:res.data.sa_orderid}})
- },
- onCancel() {},
- })
- })
- }
- const failedData = ref(null)
- const importSuccess = async (res)=>{
- const rs = await Api.requested({
- id:20230227194803,
- content:{
- sa_orderid:orderData.value.sa_orderid,
- attachmentid:res.data.attachmentids[0]
- }
- })
- utils.message(rs,'导入成功',()=>{
- prodlist.value.listData()
- mianData()
- if (rs.data !== '成功') {
- failedData.value = rs.data
- }
- })
- }
- const canPrintBoolean = ref(false)
- const reportList = ref([])
- const canPrint = async ()=>{
- const res = await Api.requested({
- id:20221213094401,
- content:{
- systemappid:app.value.systemappid,
- }
- })
- res.data.length > 0 ? canPrintBoolean.value = true : canPrintBoolean.value = false
- reportList.value = res.data
- }
- const printUrl = async (data)=>{
- const res = await Api.requested({
- id:20221213094501,
- content:{
- sys_reportid:data.sys_reportid,
- dataid: router.currentRoute.value.query.id
- }
- })
- if (res.code == 1) {
- window.open(process.env.BASE_API+res.data)
- }
- }
- const record = ref({})
- const printRef = ref()
- const printData = ()=>{
- if (reportList.value.length == 1) {
- printUrl(reportList.value[0])
- } else {
- printRef.value.open = true
- }
-
- }
- const onModeClick = async (data)=>{
- printUrl(data)
- }
- const open = ref(false)
- const prod = ref({})
- const openCustom = (data)=>{
- open.value = true
- prod.value = data
- }
- const handleOk = ()=>{
- prod.value.record.isselect = true
- prodlist.value.data.some((item)=>{
- if (item.itemid == prod.value.itemid) {
- item = prod.value
- }
- })
- open.value = false
- }
- const closeInfo = (data) => {
- data.isselect = false
- data.customcheek = null
- data.customcolors = null
- data.custommaterial = null
- data.length = null
- data.width = null
- }
- const infoFun = computed(() => {
- return (data) => {
- let customcheek = '',customcolors = '',custommaterial = '',length = '',width = ''
- if (data.cheekschemeid > 0) customcheek = data.cheekschemedetails.filter(item => item.num == data.customcheek).length ? data.cheekschemedetails.filter(item => item.num == data.customcheek)[0].num : ''
- if (data.colorschemeid > 0) customcolors = data.colorsschemedetails.filter(item => item.num == data.customcolors).length ? data.colorsschemedetails.filter(item => item.num == data.customcolors)[0].num : ''
- if (data.materialschemeid > 0) custommaterial = data.materialschemedetails.filter(item => item.num == data.custommaterial).length ? data.materialschemedetails.filter(item => item.num == data.custommaterial)[0].num :''
- if (data.spec == '自定义' || data.spec == 'custom') {
- length = data.lengthschemedetails.filter(item => item.num == data.length).length ? data.lengthschemedetails.filter(item => item.num == data.length)[0].num : ''
- width = data.widthschemedetails.filter(item => item.num == data.width).length ? data.widthschemedetails.filter(item => item.num == data.width)[0].num : ''
- if (!width) width = data.width
- if (!length) length = data.length
- }
- let result = ''
- if (customcheek) result = result + customcheek + ','
- if (customcolors) result = result + customcolors + ','
- if (custommaterial) result = result + custommaterial + ','
- if (length) result = result + length + 'x'
- if (width) result = result + width
- return result
- }
- })
- onMounted (()=>{
- mianData()
- canPrint()
- })
- onBeforeUnmount (()=>{
- prodlist.value.reloadSelect()
- })
- </script>
- <style scoped>
- .account-item-panel-content{
- display: flex;
- align-items: center;
- }
- .account-item-panel-content p{
- margin: 0;
- }
- /deep/.ant-input {
- color:#000000 !important;
- }
- input::placeholder {
- color: #000000 !important;
- }
- .label{
- display:inline-block;
- margin-right:10px
- }
- .mt-10{
- margin-bottom:20px
- }
- </style>
|