index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. <template>
  2. <div>
  3. <detail-template
  4. :headData="mainAreaData"
  5. :title="'订单号:'+orderData.sonum"
  6. :tabs="['订单明细','订单进度','发货单','收支明细','出库单','物流单']"
  7. :delParam="{id:'20221108152102',content:{sa_orderids:[router.currentRoute.value.query.id]}}"
  8. ownertable="sa_order"
  9. :disable="utils.isDisabled(orderData.status,[],(orderData.status !== '新建'))"
  10. >
  11. <template #operation>
  12. <a-space>
  13. <a-dropdown v-if="utils.hasPermission('changeClass')" :disabled="utils.isDisabled(orderData.status,['审核','新建','关闭','手工关闭'])">
  14. <template #overlay>
  15. <a-menu @click="handleMenuClick">
  16. <a-menu-item v-for="(item, index) in mxList" :key="item.value">
  17. {{item.value}}
  18. </a-menu-item>
  19. </a-menu>
  20. </template>
  21. <a-button>
  22. 分类调整
  23. </a-button>
  24. </a-dropdown>
  25. <abstract v-if="utils.hasPermission('abstract')" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='审核'))" :data="orderData" @onSuccess="mianData"></abstract>
  26. <a-button v-if="canPrintBoolean" type="primary" size="mini" @click="printData">打印</a-button>
  27. <edit v-if="utils.hasPermission('update')" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='新建'))" :data="orderData" @onSuccess="mianData"></edit>
  28. <a-space v-if="utils.isDisabled(orderData.status,[''],(orderData.type =='特殊订单'))">
  29. <a-button v-if="utils.hasPermission('preSubmissionBack')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='预提交'))" @click="onSpcialSubmit(20230331152503,'预提交撤回',false)">预提撤回</a-button>
  30. <a-button v-if="utils.hasPermission('preSubmissionConfirm')" type="primary" :disabled="utils.isDisabled(orderData.status,['提交','审核','确认','关闭','手工关闭'])" @click="onSpcialSubmit(20230331102503,'预提交确认',true)">预提交确认</a-button>
  31. <a-button v-if="utils.hasPermission('preSubmissionConfirmBack')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='确认'))" @click="onSpcialSubmit(20230331102503,'反确认',false)">反确认</a-button>
  32. </a-space>
  33. <a-button v-if="utils.hasPermission('submit')" :disabled="utils.isDisabled(orderData.status,[''],canSubmit)" type="primary" size="mini" @click="onSubmit('提交')">提 交</a-button>
  34. <returnBill :data="orderData" :enddate="enddate" :disabled="utils.isDisabled(orderData.status,['新建','预提交','确认','审核','关闭','手工关闭'])" @onSuccess="mianData"></returnBill>
  35. <a-button v-if="utils.hasPermission('examine')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='提交'))" @click="checkBill(20221108153502,'审核')">审核</a-button>
  36. <a-button v-if="utils.hasPermission('unExamine')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='审核'))" @click="checkBill(20230102141502,'反审核')">反审核</a-button>
  37. <a-button v-if="utils.hasPermission('cancel')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !== '审核'))" @click="checkBill(20230406155202,'手工关闭')">关闭</a-button>
  38. <a-button v-if="utils.hasPermission('copy')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.type === '促销订单'))">
  39. <selectEnterprise title="选择经销商" :disabled="utils.isDisabled(orderData.status,[''],(orderData.type === '促销订单'))" :param="{id:20230219195002,content:{ismanage :1,pageNumber:1,pageSize:20,where:{condition:''}}}" @onSelect="copyOrder">
  40. <template #text>复制</template>
  41. </selectEnterprise>
  42. </a-button>
  43. </a-space>
  44. </template>
  45. <template v-if="orderData.sa_accountclassinfos" #customContent>
  46. <a-divider orientation="left" orientation-margin="0px"><span class="almm">支付信息</span></a-divider>
  47. <div class="account-item-panel" v-for="item in orderData.sa_accountclassinfos" :key="item.index">
  48. <div class="account-item-panel-content">
  49. <p style="color:red;font-weight: bold;">{{item.accountname}}</p><a-divider type="vertical" />
  50. <p>实时余额: ¥<span class="accountAmount">{{utils.formatAmount(item.realbalance,{name:'hideFields',key:'realbalance'})}}</span></p><a-divider type="vertical" />
  51. <p>当时余额: ¥<span class="accountAmount">{{utils.formatAmount(item.balance,{name:'hideFields',key:'balance'})}}</span></p><a-divider type="vertical" />
  52. <p>信用额度: ¥{{utils.formatAmount(item.creditquota,{name:'hideFields',key:'creditquota'})}}</p><a-divider type="vertical" />
  53. <div>本单支出: <span style="color:red">¥{{utils.formatAmount(item.amount,{name:'hideFields',key:'amount'})}}</span></div>
  54. </div>
  55. </div>
  56. </template>
  57. <template #tab0>
  58. <normalTable :tableRowStyle="formatter" rowKey="sa_orderitemsid" ref="prodlist" :columns="utils.TBLayout('orderMxTable')" :tableid="utils.TBLayoutID('orderMxTable')" tableName="orderMxTable" size="small" :param="param" @onSelect="onSelectChange">
  59. <template v-if="utils.hasPermission('orderMxedit')" #operation>
  60. <a-space class="mt-10">
  61. <a-button :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭','手工关闭'])" :type="isEditDisabled?'primary':'dashed'" @click="editRowProd">{{isEditDisabled?'行编辑':'保存'}}</a-button>
  62. <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">
  63. </tableImport>
  64. <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:'',tablefilter:{}}}}" @onSelectChange="addProductToBody">
  65. <template #tb_cell="{data}">
  66. <template v-if="data.column.dataIndex === 'qty'">
  67. <a-input-number style="width:100%" id="inputNumber" :precision="2" v-model:value="data.record.qty" :min="data.record.orderminqty" :step="data.record.orderaddqty"/>
  68. </template>
  69. <template v-if="data.column.dataIndex === 'length' && data.record.iscustomsize == 1">
  70. <a-select v-if="data.record.lengthschemedetails.length > 0" v-model:value="data.record.length" style="width: 150px" placeholder="选择长度">
  71. <a-select-option v-for="item in data.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
  72. </a-select>
  73. <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')">
  74. </a-input>
  75. </template>
  76. <template v-if="data.column.dataIndex === 'width' && data.record.iscustomsize == 1">
  77. <a-select v-if="data.record.widthschemedetails.length > 0" v-model:value="data.record.width" style="width: 150px" placeholder="选择宽度">
  78. <a-select-option v-for="item in data.record.widthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
  79. </a-select>
  80. <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')">
  81. </a-input>
  82. </template>
  83. <template v-if="data.column.dataIndex === 'remarks'">
  84. <a-input style="width:100%" v-model:value="data.record.remarks"/>
  85. </template>
  86. </template>
  87. </select-product>
  88. <a-button :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭','手工关闭'],(selectProductList.length == 0))" type="primary" @click="deleteProd">删除商品</a-button>
  89. <order-discount :id="router.currentRoute.value.query.id" :data="selectProductList" :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭','手工关闭'])" @onSuccess="onSuccess"></order-discount>
  90. <a-button :disabled="utils.isDisabled(orderData.status,['新建','确认','提交','关闭','手工关闭'],(selectProductList.length == 0))" type="primary" @click="quickSendProduct">一键发货</a-button>
  91. <a-button :disabled="utils.isDisabled(orderData.status,['新建','确认','提交','关闭','手工关闭'],(selectProductList.length == 0))" type="primary" @click="freezeRows(true)">行冻结</a-button>
  92. <a-button :disabled="utils.isDisabled(orderData.status,['新建','确认','提交','关闭','手工关闭'],(selectProductList.length == 0))" type="primary" @click="freezeRows(false)">解冻行</a-button>
  93. <!-- <hasSelected :columns="utils.TBLayout('orderMxTable')"></hasSelected> -->
  94. </a-space>
  95. </template>
  96. <template v-if="utils.hasPermission('orderMxedit')" #tb_cell="{data}">
  97. <template v-if="data.column.dataIndex === 'qty'">
  98. <a-input-number v-if="orderData.type == '特殊订单'" v-model:value="data.record.qty" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭','手工关闭'],isEditDisabled)" @change="inputChange(data.record,'qty',isChange = true)"></a-input-number>
  99. <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',isChange = true)"></a-input-number>
  100. </template>
  101. <template v-if="data.column.dataIndex === 'price' && utils.hasPermission('priceChange')">
  102. <a-input v-if="canEdit" v-model:value="data.record.price" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭','手工关闭'],isEditDisabled)" @change="inputChange(data.record,'price',isChange = true)"></a-input>
  103. </template>
  104. <template v-if="data.column.dataIndex === 'amount' && utils.hasPermission('priceChange')">
  105. <a-input v-if="canEdit" v-model:value="data.record.amount" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭','手工关闭'],isEditDisabled)" @change="inputChange(data.record,'amount',isChange = true)"></a-input>
  106. </template>
  107. <template v-if="data.column.dataIndex === 'remarks'">
  108. <a-tooltip>
  109. <template #title>{{data.record.remarks}}</template>
  110. <a-input style="width:100%" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭','手工关闭'],isEditDisabled)" v-model:value="data.record.remarks" :min="1" @change="inputChange(data.record,'remarks',isChange = true)"/>
  111. </a-tooltip>
  112. </template>
  113. </template>
  114. </normalTable>
  115. </template>
  116. <template #tab1>
  117. <od-progress></od-progress>
  118. </template>
  119. <template #tab2>
  120. <dispatch-temp></dispatch-temp>
  121. </template>
  122. <template #tab3>
  123. <income-mx></income-mx>
  124. </template>
  125. <template #tab4>
  126. <sale-out-bill></sale-out-bill>
  127. </template>
  128. <template #tab5>
  129. <logistics-order></logistics-order>
  130. </template>
  131. </detail-template>
  132. <print ref="printRef" :list="reportList" @onModeClick="onModeClick"></print>
  133. </div>
  134. </template>
  135. <script setup>
  136. import Api from '@/api/api'
  137. import utils from '@/utils/utils'
  138. import orderDiscount from './modules/orderDiscount.vue'
  139. import normalTable from '@/template/normalTable/index.vue'
  140. import tableImport from '@/components/tableImport/index.vue'
  141. import SelectProduct from '@/template/selectProduct/index.vue'
  142. import selectEnterprise from '@/template/selectEnterprise/index.vue'
  143. import detailTemplate from '@/components/detailTemplate/index.vue'
  144. import abstract from './modules/abstract.vue'
  145. import edit from './modules/edit.vue'
  146. import returnBill from './modules/returnBill.vue'
  147. import OdProgress from './tabs/progress.vue'
  148. import DispatchTemp from './tabs/dispatch.vue'
  149. import saleOutBill from './tabs/saleOutBill.vue'
  150. import logisticsOrder from './tabs/logisticsOrder.vue'
  151. import IncomeMx from './tabs/income.vue'
  152. import print from '@/components/print/index.vue'
  153. import { Modal } from 'ant-design-vue'
  154. import { message } from 'ant-design-vue';
  155. import { storeToRefs } from 'pinia'
  156. import { useAuthStore } from '@/stores/modules/auth'
  157. import { useBaseStore } from '@/stores/modules/base'
  158. import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
  159. import { useRouter } from "vue-router";
  160. import { onMounted,ref,createVNode,computed,onBeforeUnmount } from "vue";
  161. const store = useAuthStore()
  162. const base = useBaseStore()
  163. let { app } = storeToRefs(store)
  164. const router = useRouter()
  165. const isChange = ref(false)
  166. const mainAreaData = ref([])
  167. const current = ref(0)
  168. const isEditDisabled = ref(true)
  169. const param = ref({
  170. "id": 20221109093902,
  171. "content": {
  172. "nocache":true,
  173. "sa_orderid": router.currentRoute.value.query.id, //订单ID
  174. "pageNumber": 1,
  175. "pageSize": 20,
  176. "where": {
  177. "condition": ""
  178. }
  179. },
  180. })
  181. const canSubmit = computed(()=>{
  182. if (orderData.value.type == '特殊订单' && orderData.value.status !=='确认') {
  183. return true
  184. }
  185. if (orderData.value.type == '标准订单' && orderData.value.status !== '新建') {
  186. return true
  187. }
  188. if (orderData.value.type == '促销订单' && orderData.value.status !== '新建') {
  189. return true
  190. }
  191. })
  192. const canEdit = computed(()=>{
  193. if (orderData.value.type == '特殊订单') {
  194. return true
  195. } else {
  196. return false
  197. }
  198. })
  199. const orderData = ref({})
  200. const mianData = async (...args)=>{
  201. const res = await Api.requested({
  202. "id":'20221108151302',
  203. "content": {
  204. "nocache":true,
  205. "sa_orderid":router.currentRoute.value.query.id,
  206. }
  207. })
  208. orderData.value = res.data
  209. changeDataStructure(res.data)
  210. if (orderData.value.type == '促销订单') {
  211. promotion()
  212. }
  213. }
  214. const changeDataStructure = (data) => {
  215. mainAreaData.value = utils.FormLayout('orderBillHead',data)
  216. console.log(mainAreaData.value)
  217. if (data.type === '促销订单') {
  218. mainAreaData.value.splice(0,0,{
  219. label:'活动名称',
  220. value:data.promname,
  221. span:4
  222. })
  223. mainAreaData.value.splice(1,0,{
  224. label:'方案编码',
  225. value:data.promnum,
  226. span:2
  227. })
  228. }
  229. }
  230. const selectProductList = ref([])
  231. const onSelectChange = (val) =>{
  232. selectProductList.value = val
  233. }
  234. const prodlist = ref()
  235. const hasChangeData = ref([])
  236. const inputChange = (val,type) =>{
  237. switch (type){
  238. case 'qty':
  239. val.amount = val.qty * val.price
  240. break;
  241. case 'price':
  242. val.amount = val.qty * val.price
  243. break;
  244. case 'amount':
  245. val.price = val.amount / val.qty
  246. break;
  247. default:
  248. break;
  249. }
  250. if (hasChangeData.value.some(e=>e.sa_orderitemsid == val.sa_orderitemsid)) {
  251. hasChangeData.value.filter(e=>{
  252. if (e.sa_orderitemsid == val.sa_orderitemsid) {
  253. e = val
  254. return false
  255. }
  256. })
  257. } else {
  258. hasChangeData.value = [...hasChangeData.value,...[val]]
  259. }
  260. }
  261. const editRowProd = ()=>{
  262. if (isEditDisabled.value) {
  263. isEditDisabled.value = !isEditDisabled.value
  264. return false
  265. }
  266. if (hasChangeData.value.length == 0) {
  267. isEditDisabled.value = true
  268. } else {
  269. updateProd(hasChangeData.value,'修改成功',()=>{
  270. hasChangeData.value = []
  271. isEditDisabled.value = true
  272. })
  273. }
  274. }
  275. const updateProd = async (data,msg,fn) =>{
  276. const res = await Api.post({
  277. id:20221109093602,
  278. content:{
  279. sa_orderid:orderData.value.sa_orderid,
  280. sys_enterpriseid:orderData.value.sys_enterpriseid,
  281. type:orderData.value.type,
  282. sa_order_v:orderData.value.sa_order_v,
  283. sa_contractid: orderData.value.sa_contractid,
  284. items:data.map(e=>{
  285. return {
  286. sa_orderitemsid:e.sa_orderitemsid,
  287. itemid:e.itemid,
  288. qty:e.qty,
  289. price:e.price,
  290. amount:0,
  291. sa_orderitems_v:e.sa_orderitems_v,
  292. defaultprice:e.defaultprice,
  293. remarks:e.remarks,
  294. length:e.length ? e.length:0,
  295. width:e.width ? e.width:0,
  296. sa_promotion_itemsid:e.sa_promotion_itemsid
  297. }
  298. })
  299. }
  300. })
  301. utils.message(res,msg,()=>{
  302. mianData()
  303. prodlist.value.listData()
  304. isChange.value = false
  305. fn ? fn(): ''
  306. })
  307. }
  308. const validInput = async (record,min,max,type)=>{
  309. if (record[type] > max) {
  310. record[type] = max
  311. } else if (record[type] < min) {
  312. record[type] = min
  313. } else {
  314. record[type] = record[type]
  315. }
  316. }
  317. const addProductToBody = async (val) =>{
  318. let param = {
  319. "id": 2024020201095102,
  320. "content": {
  321. "sa_orderid": orderData.value.sa_orderid,
  322. "sys_enterpriseid": orderData.value.sys_enterpriseid,
  323. "type":orderData.value.type,
  324. "sa_contractid": 0,
  325. "items":val
  326. }
  327. }
  328. base.addRepeatProd(param).then((res)=>{
  329. let data = val.map(e=>{
  330. if (e.iscustomsize == 1 && e.length && e.width) {
  331. return {
  332. sa_orderitemsid:0,
  333. itemid:e.itemid,
  334. qty:e.qty,
  335. remarks:e.remarks,
  336. length:e.length ? e.length:0,
  337. width:e.width ? e.width:0,
  338. }
  339. } else if (e.iscustomsize == 0) {
  340. return {
  341. sa_orderitemsid:0,
  342. itemid:e.itemid,
  343. remarks:e.remarks,
  344. qty:e.qty,
  345. length:0,
  346. width:0
  347. }
  348. } else {
  349. message.error(e.itemname + '定制信息有误,请检查!')
  350. }
  351. })
  352. data.filter(e=>e !== undefined).length > 0 ? updateProd(data.filter(e=>e !== undefined),'添加成功',()=>{
  353. prodlist.value.tableRecord = []
  354. }):''
  355. })
  356. }
  357. const deleteProd = ()=>{
  358. Modal.confirm({
  359. title: '删除商品',
  360. icon: createVNode(ExclamationCircleOutlined),
  361. content: `当前选中${selectProductList.value.length}个商品,删除${selectProductList.value.length}个商品!`,
  362. okText: '确认',
  363. cancelText: '取消',
  364. async onOk() {
  365. const res = await Api.post({
  366. id:20221109093702,
  367. content:{
  368. sa_orderid:orderData.value.sa_orderid,
  369. sa_orderitemsids:selectProductList.value.map(e=>{
  370. return e.sa_orderitemsid
  371. })
  372. }
  373. })
  374. utils.message(res,'删除成功',()=>{
  375. prodlist.value.reloadSelect()
  376. selectProductList.value = []
  377. prodlist.value.listData()
  378. mianData()
  379. })
  380. },
  381. onCancel() {},
  382. })
  383. }
  384. const onSuccess = ()=>{
  385. prodlist.value.listData()
  386. mianData()
  387. }
  388. const onSpcialSubmit = async (id,msg,value)=>{
  389. if (isChange.value)
  390. return message.error('商品明细未保存,请先保存后再提交!')
  391. Modal.confirm({
  392. title: '提示',
  393. icon: createVNode(ExclamationCircleOutlined),
  394. content: `确定${msg}该订单吗!`,
  395. okText: '确认',
  396. cancelText: '取消',
  397. async onOk() {
  398. const res = await Api.post({
  399. id:id,
  400. content:{
  401. "sa_orderid": orderData.value.sa_orderid,
  402. "isrecheck":value
  403. }
  404. })
  405. utils.message(res,msg + '成功',()=>{
  406. mianData()
  407. isEditDisabled.value = true
  408. })
  409. },
  410. onCancel() {},
  411. })
  412. }
  413. const checkBill = async (id,msg)=>{
  414. Modal.confirm({
  415. title: '提示',
  416. icon: createVNode(ExclamationCircleOutlined),
  417. content: `确定${msg}该订单吗?`,
  418. okText: '确认',
  419. cancelText: '取消',
  420. async onOk() {
  421. const res = await Api.post({
  422. id:id,
  423. content:{
  424. "sa_orderid": orderData.value.sa_orderid,
  425. "reviewtype":''
  426. }
  427. })
  428. utils.message(res,`${msg}成功`,()=>{
  429. mianData()
  430. })
  431. },
  432. onCancel() {},
  433. })
  434. }
  435. const zero_price = ref(false)
  436. const onSubmit = async (id,msg)=>{
  437. if (orderData.value.type == '特殊订单') {
  438. const rs = await Api.requested({
  439. id:2024060515370903,
  440. content:{
  441. "sa_orderid": orderData.value.sa_orderid,
  442. }
  443. })
  444. if (rs.data.length > 0) {
  445. zero_price.value = true
  446. }
  447. }
  448. Modal.confirm({
  449. title: '提示',
  450. icon: createVNode(ExclamationCircleOutlined),
  451. content:zero_price.value?createVNode('div', { style: 'color:red;' }, '存在单价为0的商品,是否继续提交?'):`确定提交该订单吗?`,
  452. okText: '确认',
  453. cancelText: '取消',
  454. async onOk() {
  455. const res = await Api.post({
  456. id:20221108153402,
  457. content:{
  458. "sa_orderid": orderData.value.sa_orderid,
  459. "reviewtype":''
  460. }
  461. })
  462. utils.message(res,`提交成功`,()=>{
  463. mianData()
  464. })
  465. },
  466. onCancel() {},
  467. })
  468. }
  469. const quickSendProduct = ()=>{
  470. Modal.confirm({
  471. title: '一键发货',
  472. icon: createVNode(ExclamationCircleOutlined),
  473. content: `当前选中${selectProductList.value.length}个商品!`,
  474. okText: '确认',
  475. cancelText: '取消',
  476. async onOk() {
  477. const res = await Api.post({
  478. id:20230220100604,
  479. content:{
  480. sa_orderid:orderData.value.sa_orderid,
  481. sa_orderitemsids:selectProductList.value.map(e=>{
  482. return e.sa_orderitemsid
  483. })
  484. }
  485. })
  486. utils.message(res,'创建成功',()=>{
  487. prodlist.value.reloadSelect()
  488. selectProductList.value = []
  489. router.push({path:'/dispatchDetail',query:{id:res.data.sa_dispatchid}})
  490. })
  491. },
  492. onCancel() {},
  493. })
  494. }
  495. const formatter = (_record, index) => {
  496. if (_record.undeliqty > 0 && orderData.value.status == '审核') {
  497. return 'table-striped-red'
  498. } else {
  499. return null
  500. }
  501. }
  502. /**
  503. * 获取促销订单方案详情
  504. */
  505. const enddate = ref('')
  506. const promotion = async () =>{
  507. const res = await Api.requested({
  508. id:20221230144703,
  509. content:{
  510. nocache:true,
  511. sa_promotionid:orderData.value.sa_promotionid
  512. }
  513. })
  514. enddate.value = res.data.enddate
  515. }
  516. const freezeRows = (bool)=>{
  517. if (bool && selectProductList.value.some(e=>e.isfreeze == 1)) {
  518. return message.error('存在已经冻结的行数据,请重新选择!')
  519. }
  520. if (!bool && selectProductList.value.some(e=>e.isfreeze == 0)) {
  521. return message.error('存在未冻结的行数据,请重新选择!')
  522. }
  523. Modal.confirm({
  524. title: '是否冻结行',
  525. icon: createVNode(ExclamationCircleOutlined),
  526. content: `当前选中${selectProductList.value.length}行!`,
  527. okText: '确认',
  528. cancelText: '取消',
  529. async onOk() {
  530. const res = await Api.post({
  531. id:20230508093003,
  532. content:{
  533. isfreeze:bool,
  534. sa_orderid:orderData.value.sa_orderid,
  535. sa_orderitemsids:selectProductList.value.map(e=>{
  536. return e.sa_orderitemsid
  537. })
  538. }
  539. })
  540. utils.message(res,`${bool?'冻结':'解冻'}成功`,()=>{
  541. prodlist.value.reloadSelect()
  542. selectProductList.value = []
  543. prodlist.value.listData()
  544. })
  545. },
  546. onCancel() {},
  547. })
  548. }
  549. const copyOrder = async (val)=>{
  550. const res = await Api.requested({
  551. id:20230102144502,
  552. content:{
  553. sa_orderid:orderData.value.sa_orderid,
  554. sys_enterpriseid:val.sys_enterpriseid
  555. }
  556. })
  557. utils.message(res,'复制成功',()=>{
  558. Modal.confirm({
  559. title: '提示',
  560. icon: createVNode(ExclamationCircleOutlined),
  561. content: `是否跳转到新订单?`,
  562. okText: '确认',
  563. cancelText: '取消',
  564. async onOk() {
  565. router.replace({path:'/orderDetail_cucu',query:{id:res.data.sa_orderid}})
  566. },
  567. onCancel() {},
  568. })
  569. })
  570. }
  571. const failedData = ref(null)
  572. const importSuccess = async (res)=>{
  573. const rs = await Api.requested({
  574. id:20230227194803,
  575. content:{
  576. sa_orderid:orderData.value.sa_orderid,
  577. attachmentid:res.data.attachmentids[0]
  578. }
  579. })
  580. utils.message(rs,'导入成功',()=>{
  581. prodlist.value.listData()
  582. mianData()
  583. if (rs.data !== '成功') {
  584. failedData.value = rs.data
  585. }
  586. })
  587. }
  588. const canPrintBoolean = ref(false)
  589. const reportList = ref([])
  590. const canPrint = async ()=>{
  591. const res = await Api.requested({
  592. id:20221213094401,
  593. content:{
  594. systemappid:app.value.systemappid,
  595. }
  596. })
  597. res.data.length > 0 ? canPrintBoolean.value = true : canPrintBoolean.value = false
  598. reportList.value = res.data
  599. }
  600. const printUrl = async (data)=>{
  601. const res = await Api.requested({
  602. id:20221213094501,
  603. content:{
  604. sys_reportid:data.sys_reportid,
  605. dataid: router.currentRoute.value.query.id
  606. }
  607. })
  608. if (res.code == 1) {
  609. window.open(process.env.BASE_API+res.data)
  610. }
  611. }
  612. const record = ref({})
  613. const printRef = ref()
  614. const printData = ()=>{
  615. if (reportList.value.length == 1) {
  616. printUrl(reportList.value[0])
  617. } else {
  618. printRef.value.open = true
  619. }
  620. }
  621. const onModeClick = async (data)=>{
  622. printUrl(data)
  623. }
  624. const mxList=ref([])
  625. const specOrderMx = async ()=>{
  626. const res = await Api.optionstype('specordermx')
  627. mxList.value = res.data
  628. }
  629. const handleMenuClick = async (val)=>{
  630. const res = await Api.requested({
  631. "id": 20230706094703,
  632. "content": {
  633. "sa_orderid":orderData.value.sa_orderid,
  634. "typemx":val.key
  635. }
  636. })
  637. utils.message(res,'修改成功',()=>{
  638. mianData()
  639. })
  640. }
  641. onMounted (()=>{
  642. mianData()
  643. canPrint()
  644. specOrderMx()
  645. })
  646. onBeforeUnmount (()=>{
  647. prodlist.value.reloadSelect()
  648. })
  649. </script>
  650. <style scoped>
  651. .account-item-panel-content{
  652. display: flex;
  653. align-items: center;
  654. }
  655. .account-item-panel-content p{
  656. margin: 0;
  657. }
  658. /deep/.ant-input {
  659. color:#000000;
  660. }
  661. input::placeholder {
  662. color: #000000 !important;
  663. }
  664. </style>