index.vue 32 KB

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