index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. <template>
  2. <div>
  3. <detail-template
  4. :headData="mainAreaData"
  5. :title="'订单号:' + orderData.sonum"
  6. :tabs="['订单明细', '订单进度', '发货单', '收支明细', '出库单', '物流单']"
  7. :delParam="{
  8. id: '20221108152102',
  9. content: { sa_orderids: [router.currentRoute.value.query.id] },
  10. }"
  11. :disable="
  12. utils.isDisabled(orderData.status, [
  13. '提交',
  14. '审核',
  15. '关闭',
  16. '预提交',
  17. '确认',
  18. '手工关闭',
  19. ])
  20. "
  21. size="small"
  22. :hideBorder="false"
  23. ownertable="sa_order"
  24. >
  25. <template #operation>
  26. <a-space>
  27. <edit
  28. v-if="utils.hasPermission('update')"
  29. :data="orderData"
  30. @onSuccess="mianData"
  31. :disabled="
  32. utils.isDisabled(
  33. orderData.status,
  34. ['提交', '审核', '关闭'],
  35. specialOrder('编辑')
  36. )
  37. "
  38. ></edit>
  39. <a-button
  40. v-if="canPrintBoolean"
  41. type="primary"
  42. size="mini"
  43. @click="printData"
  44. >打印</a-button
  45. >
  46. <a-button
  47. v-if="
  48. orderData.type === '特殊订单' &&
  49. utils.hasPermission('preSubmission')
  50. "
  51. type="primary"
  52. @click="preSubmission"
  53. :disabled="
  54. utils.isDisabled(orderData.status, [
  55. '提交',
  56. '审核',
  57. '关闭',
  58. '预提交',
  59. '确认',
  60. '手工关闭',
  61. ])
  62. "
  63. >预提交</a-button
  64. >
  65. <a-button
  66. v-if="utils.hasPermission('submit')"
  67. type="primary"
  68. @click="submitOrder"
  69. :disabled="
  70. utils.isDisabled(
  71. orderData.status,
  72. ['提交', '审核', '关闭'],
  73. specialOrder('提交')
  74. )
  75. "
  76. >提交</a-button
  77. >
  78. <!-- <a-button type="primary" @click="backOrder" :disabled="utils.isDisabled(orderData.status,['新建','审核','关闭'],specialOrder('撤回'))">撤回</a-button> -->
  79. </a-space>
  80. </template>
  81. <template #customContent>
  82. <a-divider orientation="left" orientation-margin="0px"
  83. ><span class="almm">支付信息</span></a-divider
  84. >
  85. <div
  86. class="account-item-panel"
  87. v-for="item in orderData.sa_accountclassinfos"
  88. :key="item.index"
  89. >
  90. <div class="account-item-panel-content">
  91. <p style="color: red; font-weight: bold">{{ item.accountname }}</p>
  92. <a-divider type="vertical" />
  93. <p>
  94. 实时余额: ¥<span class="accountAmount">{{
  95. utils.formatAmount(item.realbalance, {
  96. name: "hideFields",
  97. key: "realbalance",
  98. })
  99. }}</span>
  100. </p>
  101. <a-divider type="vertical" />
  102. <p>
  103. 当时余额: ¥<span class="accountAmount">{{
  104. utils.formatAmount(item.balance, {
  105. name: "hideFields",
  106. key: "balance",
  107. })
  108. }}</span>
  109. </p>
  110. <a-divider type="vertical" />
  111. <p>
  112. 信用额度: ¥{{
  113. utils.formatAmount(item.creditquota, {
  114. name: "hideFields",
  115. key: "creditquota",
  116. })
  117. }}
  118. </p>
  119. <a-divider type="vertical" />
  120. <div>
  121. 本单支出:
  122. <span style="color: red"
  123. >¥{{
  124. utils.formatAmount(item.amount, {
  125. name: "hideFields",
  126. key: "amount",
  127. })
  128. }}</span
  129. >
  130. </div>
  131. </div>
  132. </div>
  133. </template>
  134. <template #tab0>
  135. <product-list
  136. ref="prodlist"
  137. :columns="utils.TBLayout('orderMxTable')"
  138. tableName="orderMxTable"
  139. rowKey="sa_orderitemsid"
  140. :param="param"
  141. size="small"
  142. :hideBorder="true"
  143. @onSelect="onProdSelect"
  144. >
  145. <template #operation>
  146. <a-space class="mt-10">
  147. <!-- 添加商品 -->
  148. <a-button
  149. :disabled="
  150. utils.isDisabled(orderData.status, [
  151. '确认',
  152. '提交',
  153. '审核',
  154. '关闭',
  155. ])
  156. "
  157. :type="isEditDisabled ? 'primary' : 'dashed'"
  158. @click="editRowProd"
  159. >{{ isEditDisabled ? "行编辑" : "保存" }}</a-button
  160. >
  161. <select-product
  162. ref="selectProd"
  163. v-if="utils.hasPermission('orderMxedit')"
  164. :pagination="isPromotion"
  165. :isSelect="isPromotion"
  166. :selectAll="isPromotion"
  167. :columns="utils.TBLayout('orderAddTable')"
  168. :needQuestSearch="isPromotion ? true : false"
  169. :disabled="
  170. utils.isDisabled(
  171. orderData.status,
  172. ['提交', '审核', '关闭'],
  173. specialOrder('编辑')
  174. )
  175. "
  176. :param="listParam"
  177. @onSelectChange="(VAL)=>{isPromotion ? showQtyModal(VAL):addProductToBody(VAL)}"
  178. >
  179. <template #more>
  180. <a-tabs
  181. v-model:activeKey="activeKey"
  182. v-if="isPromotion"
  183. @change="tabChange"
  184. >
  185. <a-tab-pane
  186. v-for="(item, index) in packagetypeOptions"
  187. :key="index"
  188. :tab="item"
  189. ></a-tab-pane>
  190. </a-tabs>
  191. </template>
  192. <template #tb_cell="{ data }">
  193. <template v-if="data.column.dataIndex === 'qty'">
  194. <a-input-number
  195. style="width: 100%"
  196. id="inputNumber"
  197. :precision="2"
  198. v-model:value="data.record.qty"
  199. :min="data.record.orderminqty"
  200. :step="data.record.orderaddqty"
  201. :disabled="isPromotion"
  202. @blur="onAddQtyChange(data.record)"
  203. />
  204. </template>
  205. <template
  206. v-if="
  207. data.column.dataIndex === 'iscustom' &&
  208. data.record.iscustomsize == 1
  209. "
  210. >
  211. <a-button
  212. type="link"
  213. @click="openCustom(data)"
  214. v-if="!data.record.isselect"
  215. >定制信息</a-button
  216. >
  217. <a-tag v-else closable @close="closeInfo(data.record)">{{
  218. infoFun(data.record)
  219. }}</a-tag>
  220. </template>
  221. </template>
  222. </select-product>
  223. <a-button
  224. v-if="utils.hasPermission('orderMxedit')"
  225. :disabled="
  226. utils.isDisabled(
  227. orderData.status,
  228. ['提交', '审核', '关闭'],
  229. selectProductList.length == 0
  230. )
  231. "
  232. type="primary"
  233. @click="deleteProd"
  234. >删除商品</a-button
  235. >
  236. <changePromotionQty v-if="isPromotion" :orderData="orderData" @changePromotionQty="changePromotionEmit"/>
  237. </a-space>
  238. </template>
  239. <template #tb_cell="{ data }">
  240. <template
  241. v-if="
  242. data.column.dataIndex === 'qty' &&
  243. utils.hasPermission('orderMxedit')
  244. "
  245. >
  246. <a-input-number
  247. v-if="orderData.type == '特殊订单'"
  248. v-model:value="data.record.qty"
  249. :disabled="
  250. utils.isDisabled(
  251. orderData.status,
  252. ['提交', '审核', '关闭'],
  253. isEditDisabled
  254. )
  255. "
  256. @change="inputChange(data.record, 'qty')"
  257. ></a-input-number>
  258. <a-input-number
  259. v-else
  260. v-model:value="data.record.qty"
  261. :precision="2"
  262. :disabled="
  263. utils.isDisabled(
  264. orderData.status,
  265. ['提交', '审核', '关闭'],
  266. isEditDisabled
  267. )
  268. "
  269. :min="data.record.orderminqty"
  270. :step="data.record.orderaddqty"
  271. @change="inputChange(data.record, 'qty')"
  272. ></a-input-number>
  273. </template>
  274. <template
  275. v-if="
  276. data.column.dataIndex === 'remarks' &&
  277. utils.hasPermission('orderMxedit')
  278. "
  279. >
  280. <a-input
  281. style="width: 100%"
  282. :disabled="
  283. utils.isDisabled(
  284. orderData.status,
  285. ['提交', '审核', '关闭'],
  286. isEditDisabled
  287. )
  288. "
  289. v-model:value="data.record.remarks"
  290. :min="1"
  291. @change="inputChange(data.record)"
  292. />
  293. </template>
  294. <template v-if="data.column.dataIndex === 'stockstatus'">
  295. {{
  296. data.record.invbalqty -
  297. data.record.undeliqtysum -
  298. data.record.unsoldqty >
  299. 0
  300. ? "有货"
  301. : "无货"
  302. }}
  303. </template>
  304. </template>
  305. </product-list>
  306. </template>
  307. <template #tab1>
  308. <od-progress></od-progress>
  309. </template>
  310. <template #tab2>
  311. <dispatch-temp></dispatch-temp>
  312. </template>
  313. <template #tab3>
  314. <income-mx></income-mx>
  315. </template>
  316. <template #tab4>
  317. <sale-out-bill></sale-out-bill>
  318. </template>
  319. <template #tab5>
  320. <logistics-order></logistics-order>
  321. </template>
  322. </detail-template>
  323. <a-modal
  324. v-model:open="open"
  325. wrapClassName="oder-modal"
  326. title="定制信息"
  327. @ok="handleOk"
  328. style="text-align: left"
  329. :closable="false"
  330. >
  331. <div
  332. class="mt-10"
  333. style="display: flex; justify-content: space-evenly; margin-top: 20px"
  334. >
  335. <div style="display: flex; align-items: center; color: red">
  336. <span class="label">品号:{{ prod.record.itemno }}</span>
  337. <span
  338. class="label overflow"
  339. style="max-width: 220px; margin-left: 10px"
  340. >品名:
  341. <a-tooltip
  342. placement="topLeft"
  343. :title="prod.record.itemname"
  344. arrow-point-at-center
  345. >
  346. {{ prod.record.itemname }}
  347. </a-tooltip>
  348. </span>
  349. </div>
  350. </div>
  351. <div class="mt-10" v-if="prod.record.cheekschemeid > 0">
  352. <span class="label">工艺</span>
  353. <a-select
  354. v-model:value="prod.record.customcheek"
  355. style="width: 400px"
  356. placeholder="选择工艺"
  357. >
  358. <a-select-option
  359. v-for="item in prod.record.cheekschemedetails"
  360. :key="item.sa_sizeschemedetailid"
  361. :value="item.num"
  362. >{{ item.num }}</a-select-option
  363. >
  364. </a-select>
  365. </div>
  366. <div class="mt-10" v-if="prod.record.colorschemeid > 0">
  367. <span class="label">颜色</span>
  368. <a-select
  369. v-model:value="prod.record.customcolors"
  370. style="width: 400px"
  371. placeholder="选择颜色"
  372. >
  373. <a-select-option
  374. v-for="item in prod.record.colorsschemedetails"
  375. :key="item.sa_sizeschemedetailid"
  376. :value="item.num"
  377. >{{ item.num }}</a-select-option
  378. >
  379. </a-select>
  380. </div>
  381. <div class="mt-10" v-if="prod.record.materialschemeid > 0">
  382. <span class="label">选项</span>
  383. <a-select
  384. v-model:value="prod.record.custommaterial"
  385. style="width: 400px"
  386. placeholder="选择选项"
  387. >
  388. <a-select-option
  389. v-for="item in prod.record.materialschemedetails"
  390. :key="item.sa_sizeschemedetailid"
  391. :value="item.num"
  392. >{{ item.num }}</a-select-option
  393. >
  394. </a-select>
  395. </div>
  396. <div
  397. class="mt-10"
  398. v-if="prod.record.spec == '自定义' || prod.record.spec == 'custom'"
  399. >
  400. <span class="label">长度</span>
  401. <a-select
  402. v-if="prod.record.lengthschemedetails.length > 0"
  403. v-model:value="prod.record.length"
  404. style="width: 400px"
  405. placeholder="选择长度"
  406. >
  407. <a-select-option
  408. v-for="item in prod.record.lengthschemedetails"
  409. :key="item.sa_sizeschemedetailid"
  410. :value="item.num"
  411. >{{ item.num }}</a-select-option
  412. >
  413. </a-select>
  414. <a-input
  415. v-else
  416. style="width: 400px"
  417. v-model:value="prod.record.length"
  418. :placeholder="`输入${prod.record.lengthmin}到${prod.record.lengthmax}毫米`"
  419. @blur="
  420. validInput(
  421. prod.record,
  422. prod.record.lengthmin,
  423. prod.record.lengthmax,
  424. 'length'
  425. )
  426. "
  427. >
  428. </a-input>
  429. </div>
  430. <div
  431. class="mt-10"
  432. v-if="prod.record.spec == '自定义' || prod.record.spec == 'custom'"
  433. >
  434. <span class="label">宽度</span>
  435. <a-select
  436. v-if="prod.record.widthschemedetails.length > 0"
  437. v-model:value="prod.record.width"
  438. style="width: 400px"
  439. placeholder="选择宽度"
  440. >
  441. <a-select-option
  442. v-for="item in prod.record.widthschemedetails"
  443. :key="item.sa_sizeschemedetailid"
  444. :value="item.num"
  445. >{{ item.num }}</a-select-option
  446. >
  447. </a-select>
  448. <a-input
  449. v-else
  450. style="width: 400px"
  451. v-model:value="prod.record.width"
  452. :placeholder="`输入${prod.record.widthmin}到${prod.record.widthmax}毫米`"
  453. @blur="
  454. validInput(
  455. prod.record,
  456. prod.record.widthmin,
  457. prod.record.widthmax,
  458. 'width'
  459. )
  460. "
  461. >
  462. </a-input>
  463. </div>
  464. </a-modal>
  465. <a-modal v-model:open="qtyModal" :width="400" title="购买套数" ok-text="确认" cancel-text="取消" @ok="promotionToBillBody" @cancel="hideModal">
  466. <a-input placeholder="输入购买套数" v-model:value="promotionQty" type="number" style="margin:20px 0;" @change="promotionQtyChange"></a-input>
  467. </a-modal>
  468. </div>
  469. </template>
  470. <script setup>
  471. import Api from "@/api/api";
  472. import productList from "@/template/normalTable/index.vue";
  473. import SelectProduct from "@/template/selectProduct/index.vue";
  474. import detailTemplate from "@/components/detailTemplate/index.vue";
  475. import edit from "./modules/edit.vue";
  476. import OdProgress from "./tabs/progress.vue";
  477. import DispatchTemp from "./tabs/dispatch.vue";
  478. import IncomeMx from "./tabs/income.vue";
  479. import saleOutBill from "./tabs/saleOutBill.vue";
  480. import logisticsOrder from "./tabs/logisticsOrder.vue";
  481. import changePromotionQty from "./modules/changePromotionQty.vue";
  482. import { storeToRefs } from "pinia";
  483. import { useAuthStore } from "@/stores/modules/auth";
  484. import { useBaseStore } from "@/stores/modules/base";
  485. import { Modal } from "ant-design-vue";
  486. import { message } from "ant-design-vue";
  487. import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
  488. import { useRouter } from "vue-router";
  489. import {
  490. onMounted,
  491. ref,
  492. getCurrentInstance,
  493. createVNode,
  494. computed,
  495. nextTick,
  496. } from "vue";
  497. import utils from "@/utils/utils";
  498. const store = useAuthStore();
  499. const base = useBaseStore();
  500. let { app } = storeToRefs(store);
  501. const router = useRouter();
  502. const mainAreaData = ref([]);
  503. const isPromotion = computed(() => {
  504. return orderData.value.packagetype !== "" ? true : false;
  505. });
  506. const selectProd = ref();
  507. const activeKey = ref(0);
  508. const param = ref({
  509. id: 20221109093902,
  510. content: {
  511. sa_orderid: router.currentRoute.value.query.id, //订单ID
  512. pageNumber: 1,
  513. pageSize: 20,
  514. where: {
  515. condition: "",
  516. },
  517. },
  518. });
  519. let time = ref(null);
  520. const prodlist = ref(null);
  521. const orderData = ref({});
  522. const selectProductList = ref([]);
  523. const getId = computed(() => {
  524. let id = 0;
  525. switch (orderData.value.type) {
  526. case "标准订单":
  527. id = 20221109153502;
  528. break;
  529. case "促销订单":
  530. id = 20230107182302;
  531. break;
  532. default:
  533. id = 20221109153502;
  534. break;
  535. }
  536. return id;
  537. });
  538. const specialOrder = (btn) => {
  539. if (orderData.value.type === "特殊订单") {
  540. if (orderData.value.status === "确认" && btn === "提交") {
  541. return false;
  542. } else if (orderData.value.status === "预提交") {
  543. return true;
  544. } else if (orderData.value.status === "新建" && btn === "编辑") {
  545. return false;
  546. } else {
  547. return true;
  548. }
  549. } else {
  550. return false;
  551. }
  552. };
  553. const listParam = ref({});
  554. const mianData = async () => {
  555. const res = await Api.requested({
  556. id: "20221108151302",
  557. content: {
  558. nocache: true,
  559. sa_orderid: router.currentRoute.value.query.id,
  560. },
  561. });
  562. orderData.value = res.data;
  563. listParam.value = {
  564. id: getId.value,
  565. content: {
  566. sa_orderid: res.data.sa_orderid,
  567. pageNumber: 1,
  568. pageSize: 20,
  569. where: { condition: "" },
  570. },
  571. };
  572. changeDataStructure(res.data);
  573. isPromotion ? getPackagetype() : "";
  574. };
  575. const changeDataStructure = (data) => {
  576. mainAreaData.value = utils.FormLayout("detailsHead", data);
  577. if (data.type === "促销订单") {
  578. mainAreaData.value.splice(0, 0, {
  579. label: "活动名称",
  580. value: data.promname,
  581. span: 4,
  582. style: function () {
  583. return { fontWeight: "bold", color: "#52c41a" };
  584. },
  585. });
  586. mainAreaData.value.splice(1, 0, {
  587. label: "方案编码",
  588. value: data.promnum,
  589. span: 2,
  590. style: function () {
  591. return { fontWeight: "bold", color: "#52c41a" };
  592. },
  593. });
  594. }
  595. };
  596. const isEditDisabled = ref(true);
  597. const editRowProd = () => {
  598. if (isEditDisabled.value) {
  599. isEditDisabled.value = !isEditDisabled.value;
  600. return false;
  601. }
  602. if (hasChangeData.value.length == 0) {
  603. isEditDisabled.value = true;
  604. } else {
  605. updateProd(hasChangeData.value, "修改成功", () => {
  606. hasChangeData.value = [];
  607. isEditDisabled.value = true;
  608. });
  609. }
  610. };
  611. const changePromotionEmit = (data,fn)=>{
  612. updateProd(data,'修改成功',fn)
  613. }
  614. const updateProd = async (data, msg, fn) => {
  615. const res = await Api.post({
  616. id: 20221109093602,
  617. content: {
  618. sa_orderid: orderData.value.sa_orderid,
  619. sys_enterpriseid: orderData.value.sys_enterpriseid,
  620. type: orderData.value.type,
  621. sa_contractid: orderData.value.sa_contractid,
  622. items: data.map((e) => {
  623. return {
  624. sa_orderitemsid: e.sa_orderitemsid,
  625. itemid: e.itemid,
  626. qty: e.qty,
  627. price: e.price,
  628. amount: 0,
  629. defaultprice: e.defaultprice,
  630. remarks: e.remarks,
  631. length: e.length ? e.length : 0,
  632. width: e.width ? e.width : 0,
  633. sa_promotion_itemsid: e.sa_promotion_itemsid,
  634. customcolors: e.customcolors ? e.customcolors : "",
  635. customcheek: e.customcheek ? e.customcheek : "",
  636. custommaterial: e.custommaterial ? e.custommaterial : "",
  637. };
  638. }),
  639. },
  640. });
  641. utils.message(res, msg, () => {
  642. mianData();
  643. prodlist.value.listData();
  644. fn ? fn() : "";
  645. });
  646. };
  647. const validInput = async (record, min, max, type) => {
  648. if (!record[type]) return;
  649. if (record[type] > max) {
  650. record[type] = max;
  651. } else if (record[type] < min) {
  652. record[type] = min;
  653. } else {
  654. record[type] = record[type];
  655. }
  656. };
  657. const qtyModal = ref(false)
  658. const promotionQty = ref(null)
  659. const promotionList = ref([])
  660. const showQtyModal = (val)=>{
  661. qtyModal.value = true
  662. promotionList.value = val
  663. }
  664. const hideModal = ()=>{
  665. qtyModal.value = false
  666. promotionQty.value = null
  667. selectProd.value.visible = false
  668. }
  669. const promotionToBillBody = ()=>{
  670. addProductToBody(promotionList.value)
  671. hideModal()
  672. }
  673. const addProductToBody = async (val) => {
  674. let param = {
  675. id: 2024020201095102,
  676. content: {
  677. sa_orderid: orderData.value.sa_orderid,
  678. sys_enterpriseid: orderData.value.sys_enterpriseid,
  679. type: orderData.value.type,
  680. sa_contractid: 0,
  681. items: val,
  682. },
  683. };
  684. base.addRepeatProd(param,()=>{
  685. if (isPromotion) {
  686. message.error('该套餐已存在,请勿重复添加!')
  687. return false
  688. }
  689. }).then((res) => {
  690. console.log(res)
  691. const allowAdd = (e) => {
  692. if (e.iscustomsize == 1) {
  693. if (!e.length || !e.width) {
  694. message.error(e.itemname + "定制信息有误,请检查!");
  695. } else if (e.cheekschemeid > 0 && !e.customcheek) {
  696. message.error(e.itemname + "工艺定制信息有误,请检查!");
  697. } else if (e.colorschemeid > 0 && !e.customcolors) {
  698. message.error(e.itemname + "颜色定制信息有误,请检查!");
  699. } else if (e.materialschemeid > 0 && !e.custommaterial) {
  700. message.error(e.itemname + "选项定制信息有误,请检查!");
  701. } else {
  702. return {
  703. sa_orderitemsid: 0,
  704. itemid: e.itemid,
  705. qty:isPromotion ?e.qty * promotionQty.value : e.qty,
  706. length: e.length ? e.length : 0,
  707. width: e.width ? e.width : 0,
  708. customcolors: e.customcolors ? e.customcolors : 0,
  709. customcheek: e.customcheek ? e.customcheek : 0,
  710. custommaterial: e.custommaterial ? e.custommaterial : 0,
  711. sa_promotion_itemsid: e.sa_promotion_itemsid ? e.sa_promotion_itemsid : 0,
  712. };
  713. }
  714. } else {
  715. return {
  716. sa_orderitemsid: 0,
  717. itemid: e.itemid,
  718. sa_promotion_itemsid: e.sa_promotion_itemsid ? e.sa_promotion_itemsid : 0 ,
  719. qty: isPromotion ? e.qty * promotionQty.value : e.qty,
  720. length: 0,
  721. width: 0,
  722. };
  723. }
  724. };
  725. let data = val.map((e) => {
  726. return allowAdd(e);
  727. });
  728. data.some((e) => e == undefined)
  729. ? ""
  730. : updateProd(data, "添加成功", () => {
  731. prodlist.value.tableRecord = [];
  732. });
  733. });
  734. };
  735. const onAddQtyChange = (val) => {
  736. utils
  737. .validateInputNumber(val.orderminqty, val.qty, val.orderaddqty)
  738. .then((res) => {
  739. val.qty = res;
  740. });
  741. };
  742. const hasChangeData = ref([]);
  743. const inputChange = (val, type) => {
  744. switch (type) {
  745. case "qty":
  746. val.amount = val.qty * val.price;
  747. break;
  748. default:
  749. break;
  750. }
  751. if (
  752. hasChangeData.value.some((e) => e.sa_orderitemsid == val.sa_orderitemsid)
  753. ) {
  754. hasChangeData.value.filter((e) => {
  755. if (e.sa_orderitemsid == val.sa_orderitemsid) {
  756. e = val;
  757. return false;
  758. }
  759. });
  760. } else {
  761. hasChangeData.value = [...hasChangeData.value, ...[val]];
  762. }
  763. };
  764. const onProdSelect = (val) => {
  765. selectProductList.value = val;
  766. };
  767. const deleteProd = () => {
  768. Modal.confirm({
  769. title: "删除商品",
  770. icon: createVNode(ExclamationCircleOutlined),
  771. content:
  772. orderData.value.promitionType == "套餐活动"
  773. ? `该商品为套餐商品,删除后该套餐下所有商品都会被删除,确认删除吗?`
  774. : `当前选中${selectProductList.value.length}个商品,删除${selectProductList.value.length}个商品!`,
  775. okText: "确认",
  776. cancelText: "取消",
  777. async onOk() {
  778. const res = await Api.requested({
  779. id: 20221109093702,
  780. content: {
  781. sa_orderid: orderData.value.sa_orderid,
  782. sa_orderitemsids: selectProductList.value.map((e) => {
  783. return e.sa_orderitemsid;
  784. }),
  785. },
  786. });
  787. utils.message(res, "删除成功", () => {
  788. prodlist.value.reloadSelect();
  789. selectProductList.value = [];
  790. prodlist.value.listData();
  791. mianData();
  792. });
  793. },
  794. onCancel() {},
  795. });
  796. };
  797. const submitOrder = () => {
  798. Modal.confirm({
  799. title: "提交订单",
  800. icon: createVNode(ExclamationCircleOutlined),
  801. content: `确认提交该订单吗!`,
  802. okText: "确认",
  803. cancelText: "取消",
  804. async onOk() {
  805. const res = await Api.post({
  806. id: 20221108153402,
  807. content: {
  808. sa_orderid: orderData.value.sa_orderid,
  809. sys_enterpriseid: orderData.value.sys_enterpriseid,
  810. sa_accountclassid: orderData.value.sa_accountclassid,
  811. },
  812. });
  813. utils.message(res, "提交成功", () => {
  814. mianData();
  815. });
  816. },
  817. onCancel() {},
  818. });
  819. };
  820. const backOrder = () => {
  821. Modal.confirm({
  822. title: "撤回订单",
  823. icon: createVNode(ExclamationCircleOutlined),
  824. content: `确认撤回该订单吗!`,
  825. okText: "确认",
  826. cancelText: "取消",
  827. async onOk() {
  828. const res = await Api.requested({
  829. id: 20230301190202,
  830. content: {
  831. sa_orderid: orderData.value.sa_orderid,
  832. },
  833. });
  834. utils.message(res, "撤回成功", () => {
  835. mianData();
  836. });
  837. },
  838. onCancel() {},
  839. });
  840. };
  841. const preSubmission = async () => {
  842. Modal.confirm({
  843. title: "预提交订单",
  844. icon: createVNode(ExclamationCircleOutlined),
  845. content: `确认预提交该订单吗!`,
  846. okText: "确认",
  847. cancelText: "取消",
  848. async onOk() {
  849. const res = await Api.requested({
  850. id: 20230331152503,
  851. content: {
  852. sa_orderid: orderData.value.sa_orderid,
  853. isrecheck: true,
  854. },
  855. });
  856. utils.message(res, "预提交成功", () => {
  857. mianData();
  858. });
  859. },
  860. onCancel() {},
  861. });
  862. };
  863. const onSearch = () => {
  864. param.value.content.pageNumber = 1;
  865. prodlist.value.listData();
  866. };
  867. const canPrintBoolean = ref(false);
  868. const reportList = ref([]);
  869. const canPrint = async () => {
  870. const res = await Api.requested({
  871. id: 20221213094401,
  872. content: {
  873. systemappid: app.value.systemappid,
  874. },
  875. });
  876. res.data.length > 0
  877. ? (canPrintBoolean.value = true)
  878. : (canPrintBoolean.value = false);
  879. reportList.value = res.data;
  880. };
  881. const printUrl = async (data) => {
  882. const res = await Api.requested({
  883. id: 20221213094501,
  884. content: {
  885. sys_reportid: data.sys_reportid,
  886. dataid: router.currentRoute.value.query.id,
  887. },
  888. });
  889. if (res.code == 1) {
  890. window.open(process.env.BASE_API + res.data);
  891. }
  892. };
  893. const record = ref({});
  894. const printRef = ref();
  895. const printData = () => {
  896. if (reportList.value.length == 1) {
  897. printUrl(reportList.value[0]);
  898. } else {
  899. printRef.value.open = true;
  900. }
  901. };
  902. const open = ref(false);
  903. const prod = ref({});
  904. const openCustom = (data) => {
  905. open.value = true;
  906. prod.value = data;
  907. };
  908. const handleOk = () => {
  909. prod.value.record.isselect = true;
  910. prodlist.value.data.some((item) => {
  911. if (item.itemid == prod.value.itemid) {
  912. item = prod.value;
  913. }
  914. });
  915. open.value = false;
  916. };
  917. const closeInfo = (data) => {
  918. data.isselect = false;
  919. data.customcheek = null;
  920. data.customcolors = null;
  921. data.custommaterial = null;
  922. data.length = null;
  923. data.width = null;
  924. };
  925. const infoFun = computed(() => {
  926. return (data) => {
  927. let customcheek = "",
  928. customcolors = "",
  929. custommaterial = "",
  930. length = "",
  931. width = "";
  932. if (data.cheekschemeid > 0)
  933. customcheek = data.cheekschemedetails.filter(
  934. (item) => item.num == data.customcheek
  935. ).length
  936. ? data.cheekschemedetails.filter(
  937. (item) => item.num == data.customcheek
  938. )[0].num
  939. : "";
  940. if (data.colorschemeid > 0)
  941. customcolors = data.colorsschemedetails.filter(
  942. (item) => item.num == data.customcolors
  943. ).length
  944. ? data.colorsschemedetails.filter(
  945. (item) => item.num == data.customcolors
  946. )[0].num
  947. : "";
  948. if (data.materialschemeid > 0)
  949. custommaterial = data.materialschemedetails.filter(
  950. (item) => item.num == data.custommaterial
  951. ).length
  952. ? data.materialschemedetails.filter(
  953. (item) => item.num == data.custommaterial
  954. )[0].num
  955. : "";
  956. if (data.spec == "自定义" || data.spec == "custom") {
  957. length = data.lengthschemedetails.filter(
  958. (item) => item.num == data.length
  959. ).length
  960. ? data.lengthschemedetails.filter((item) => item.num == data.length)[0]
  961. .num
  962. : "";
  963. width = data.widthschemedetails.filter((item) => item.num == data.width)
  964. .length
  965. ? data.widthschemedetails.filter((item) => item.num == data.width)[0]
  966. .num
  967. : "";
  968. if (!width) width = data.width;
  969. if (!length) length = data.length;
  970. }
  971. let result = "";
  972. if (customcheek) result = result + customcheek + ",";
  973. if (customcolors) result = result + customcolors + ",";
  974. if (custommaterial) result = result + custommaterial + ",";
  975. if (length) result = result + length + "x";
  976. if (width) result = result + width;
  977. return result;
  978. };
  979. });
  980. const onModeClick = async (data) => {
  981. printUrl(data);
  982. };
  983. const packagetypeOptions = ref([]);
  984. const getPackagetype = async (fn) => {
  985. const res = await Api.optionstype("package");
  986. packagetypeOptions.value = res.data.filter((e) => {
  987. if (e.value == orderData.value.packagetype) {
  988. return e;
  989. }
  990. })[0].subvalues;
  991. listParam.value.content.pageSize = 100;
  992. listParam.value.content.where.packagetypemx = packagetypeOptions.value[0];
  993. };
  994. const tabChange = (val) => {
  995. activeKey.value = val;
  996. listParam.value.content.where.packagetypemx =
  997. packagetypeOptions.value[activeKey.value];
  998. selectProd.value.listData();
  999. };
  1000. onMounted(() => {
  1001. mianData();
  1002. canPrint();
  1003. });
  1004. </script>
  1005. <style scoped>
  1006. .flex {
  1007. display: flex;
  1008. }
  1009. .search-input {
  1010. width: 300px;
  1011. margin-bottom: 20px;
  1012. }
  1013. .account-item-panel-content {
  1014. display: flex;
  1015. align-items: center;
  1016. }
  1017. .account-item-panel-content p {
  1018. margin: 0;
  1019. }
  1020. /deep/.ant-input {
  1021. color: #000000 !important;
  1022. }
  1023. input::placeholder {
  1024. color: #000000 !important;
  1025. }
  1026. .label {
  1027. display: inline-block;
  1028. margin-right: 10px;
  1029. }
  1030. .mt-10 {
  1031. margin-bottom: 20px;
  1032. }
  1033. .overflow {
  1034. text-overflow: ellipsis;
  1035. white-space: nowrap;
  1036. overflow: hidden;
  1037. }
  1038. </style>
  1039. <style>
  1040. .oder-modal .ant-modal-title {
  1041. display: flex !important;
  1042. justify-content: space-evenly !important;
  1043. }
  1044. </style>