index.vue 32 KB

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