index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. <template>
  2. <a-card :bordered="false" style="margin-bottom: 10px" class="mb-2">
  3. <a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
  4. <a-row :gutter="24">
  5. <a-col :span="6">
  6. <a-form-item label="订单编号" name="orderNumber">
  7. <a-input v-model:value="searchFormState.orderNumber" placeholder="订单编号查询" />
  8. </a-form-item>
  9. </a-col>
  10. <a-col :span="6">
  11. <a-form-item label="订单名称" name="orderName">
  12. <a-input v-model:value="searchFormState.orderName" placeholder="订单名称查询" />
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="客户名称" name="customerName">
  17. <a-input v-model:value="searchFormState.customerName" placeholder="客户名称查询" />
  18. </a-form-item>
  19. </a-col>
  20. <template v-if="advanced">
  21. <a-col :span="6">
  22. <a-form-item label="货品名称" name="goodsName">
  23. <a-input v-model:value="searchFormState.goodsName" placeholder="货品名称查询" />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :span="6">
  27. <a-form-item label="订单状态" name="orderStatus">
  28. <a-select v-model:value="searchFormState.orderStatus" placeholder="订单状态查询"
  29. :options="orderStatusList"
  30. > </a-select>
  31. </a-form-item>
  32. </a-col>
  33. <!-- <a-col :span="6">
  34. <a-form-item label="订单来源" name="orderSource">
  35. <a-select v-model:value="searchFormState.orderSource" placeholder="订单状态查询"
  36. :options="orderSourceList"
  37. > </a-select>
  38. </a-form-item>
  39. </a-col>-->
  40. </template>
  41. <a-col :span="6">
  42. <a-button type="primary" @click="tableRef.refresh()">查询</a-button>
  43. <a-button style="margin: 0 8px" @click="reset">重置</a-button>
  44. <a @click="toggleAdvanced" style="margin-left: 8px">
  45. {{ advanced ? '收起' : '展开' }}
  46. <component :is="advanced ? 'up-outlined' : 'down-outlined'" />
  47. </a>
  48. </a-col>
  49. </a-row>
  50. </a-form>
  51. </a-card>
  52. <a-card :bordered="false">
  53. <s-table
  54. ref="tableRef"
  55. :columns="columns"
  56. :data="loadData"
  57. bordered
  58. :row-key="(record) => record.id"
  59. >
  60. <template #operator class="table-operator">
  61. <a-space>
  62. <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizOrderAdd')">
  63. <template #icon><plus-outlined /></template>
  64. 新增
  65. </a-button>
  66. <a-button @click="exportTotal" v-if="hasPerm('bizOrderExport')">
  67. <template #icon>
  68. <export-outlined/>
  69. </template>
  70. 导出
  71. </a-button>
  72. </a-space>
  73. </template>
  74. <template #bodyCell="{ column, record }">
  75. <template v-if="column.dataIndex === 'orderType'">
  76. <a-tag
  77. :color="
  78. record.orderType === '1'
  79. ? 'orange'
  80. : record.orderType === '2'
  81. ? 'green'
  82. : 'purple'
  83. "
  84. >
  85. {{ $TOOL.dictTypeData('order_type', record.orderType) }}
  86. </a-tag>
  87. </template>
  88. <template v-if="column.dataIndex === 'orderSource'">
  89. <a-tag
  90. :color="
  91. record.orderSource === '1'
  92. ? 'orange'
  93. : record.orderSource === '2'
  94. ? 'green'
  95. : 'purple'
  96. "
  97. >
  98. {{ $TOOL.dictTypeData('order_source', record.orderSource) }}
  99. </a-tag>
  100. </template>
  101. <template v-if="column.dataIndex === 'orderStatus'">
  102. <a-tag
  103. :color="
  104. record.orderStatus === '1'
  105. ? 'blue'
  106. : record.orderStatus === '2'
  107. ? 'warning'
  108. : record.orderStatus === '3'
  109. ? 'processing'
  110. : record.orderStatus === '4'
  111. ? 'volcano'
  112. : record.orderStatus === '5'
  113. ? 'purple'
  114. : record.orderStatus === '6'
  115. ? 'error'
  116. : record.orderStatus === '7'
  117. ? 'red'
  118. : '#f50'
  119. "
  120. >
  121. {{ $TOOL.dictTypeData('order_status', record.orderStatus) }}
  122. </a-tag>
  123. </template>
  124. <template v-if="column.dataIndex === 'orderWeight'">
  125. {{record.orderWeight + '吨'}}
  126. </template>
  127. <template v-if="column.dataIndex === 'netWeight'">
  128. {{record.netWeight + '吨'}}
  129. </template>
  130. <template v-if="column.dataIndex === 'action'">
  131. <a @click="showModal(record)" v-if="record.orderStatus == '3' || record.orderStatus == '4'">二维码</a>
  132. <a-divider type="vertical" v-if="record.orderStatus == '3' || record.orderStatus == '4'"/>
  133. <a-dropdown v-if="(hasPerm('bizOrderEdit')) || (hasPerm('bizOrderDelete'))
  134. ">
  135. <a class="ant-dropdown-link">
  136. 更多
  137. <DownOutlined />
  138. </a>
  139. <template #overlay>
  140. <a-menu>
  141. <a-menu-item>
  142. <a size="small" type="link" @click="detailRef.onOpen(record)" >详情</a>
  143. </a-menu-item>
  144. <a-menu-item v-if="hasPerm('bizOrderSubmit') && record.orderStatus=='0'">
  145. <a style="color:orangered" size="small" type="link" @click="submit(record.id)">提交</a>
  146. </a-menu-item>
  147. <a-menu-item v-if="hasPerm('bizOrderEdit') && (record.orderStatus == '0')">
  148. <a style="color:blue" size="small" type="link" @click="formRef.onOpen(record)" >编辑</a>
  149. </a-menu-item>
  150. <a-menu-item v-if="hasPerm('bizOrderDelete') && (record.orderStatus == '0')">
  151. <a style="color:red" size="small" type="link" @click="deleteConfig(record)">删除</a>
  152. </a-menu-item>
  153. <!-- <a-menu-item v-if="record.orderStatus == '1'">
  154. <a style="color:orange" @click="selectCustomer(record)">绑定</a>
  155. </a-menu-item>-->
  156. <a-menu-item v-if="hasPerm('bizOrderSign') && record.orderStatus == '1'">
  157. <a style="color:orange" @click="XnSignNameRef.show(record.id)">签名</a>
  158. </a-menu-item>
  159. <a-menu-item v-if="hasPerm('bizOrderConfirm') && record.orderStatus == '2'">
  160. <a style="color:blue" @click="orderConfirm(record.id)">确认</a>
  161. </a-menu-item>
  162. <a-menu-item v-if="hasPerm('bizOrderAudit') && record.orderStatus == '5'">
  163. <a style="color:green" @click="reviewRef.showModal(record.id)">审核</a>
  164. </a-menu-item>
  165. <a-menu-item v-if="hasPerm('bizOrderFlow') && (record.orderStatus == '4' || record.orderStatus=='5' || record.orderStatus=='6' || record.orderStatus=='7')">
  166. <a style="color:deepskyblue" @click="flowRef.onOpen(record)">流水</a>
  167. </a-menu-item>
  168. <a-menu-item v-if="hasPerm('bizOrderConfig') && (record.orderStatus == '3' || record.orderStatus=='4')">
  169. <a style="color:forestgreen" @click="showMore(record)">配置</a>
  170. </a-menu-item>
  171. <a-menu-item v-if="hasPerm('bizOrderEnd') && (record.orderStatus == '3' || record.orderStatus == '4')">
  172. <a style="color:red" @click="endRef.showModal(record.id)">结束</a>
  173. </a-menu-item>
  174. </a-menu>
  175. </template>
  176. </a-dropdown>
  177. <!-- <a-space>
  178. <a @click="formRef.onOpen(record)" v-if="hasPerm('bizOrderEdit')">编辑</a>
  179. <a-divider type="vertical" v-if="hasPerm(['bizOrderEdit', 'bizOrderDelete'], 'and')" />
  180. <a-button type="link" danger size="small" v-if="hasPerm('bizOrderDelete')" @click="deleteConfig(record)">删除</a-button>
  181. </a-space>-->
  182. </template>
  183. </template>
  184. </s-table>
  185. </a-card>
  186. <Form ref="formRef" @successful="tableRef.refresh()" />
  187. <Detail ref="detailRef" @successful="tableRef.refresh()" />
  188. <Flow ref="flowRef" @successful="tableRef.refresh()" />
  189. <Review ref="reviewRef" @successful="tableRef.refresh(true)" />
  190. <End ref="endRef" @successful="tableRef.refresh(true)" />
  191. <XnSignName ref="XnSignNameRef" :image="searchFormState.orderSign" @successful="signSuccess" />
  192. <a-modal v-model:visible="open" title="二维码" width="600px" style="height: 700px">
  193. <div id="qrcode" style="text-align: center; margin: 15px 5px 15px 5px">
  194. <a-row>
  195. <a-col :span="13" id="colFlag">
  196. <div style="margin-top:10px;font-size:16px;">
  197. <p id="projectNameFlag">订单名称:{{nowRecord.orderName}}</p>
  198. <p id="projectCodeFlag">订单编码:{{ nowRecord.orderNumber }}</p>
  199. <p id="projectCodeFlag">客户名称:{{ nowRecord.customerName }}</p>
  200. <p id="projectCodeFlag">货品名称:{{ nowRecord.goodsName }}</p>
  201. <p id="projectCodeFlag">提货时间:{{ nowRecord.confStartTime+'~'+nowRecord.confEndTime }}</p>
  202. </div>
  203. </a-col>
  204. <a-col :span="11">
  205. <a-image width="250" height="100%" :src="qrCodeUrl.codeUrl"></a-image>
  206. </a-col>
  207. </a-row>
  208. </div>
  209. <template #footer>
  210. <a-button @click="closeQrCode">关闭</a-button>
  211. <a-button type="primary" @click="downloadFile">下载</a-button>
  212. </template>
  213. </a-modal>
  214. <xn-customer-selector
  215. ref="CustomerSelectorPlusRef"
  216. :add-show="false"
  217. :show="false"
  218. :role-global="true"
  219. @onBack="customerBack"
  220. />
  221. <a-modal
  222. v-model:visible="moreFlag"
  223. title="扫码次数配置"
  224. :footer="null"
  225. width="1100px"
  226. :body-style="{
  227. height: 'calc(100vh - 300px)',
  228. overflow: 'auto'
  229. }"
  230. @cancel="onCloseAccount"
  231. >
  232. <a-card :bordered="false">
  233. <!-- <a-button type="primary" @click="addAccount()" style="margin-bottom:10px;">
  234. <template #icon><plus-outlined /></template>
  235. 新增
  236. </a-button>-->
  237. <a-table ref="tableRef" :columns="columns1" :data-source="data1" bordered :row-key="(record) => record.id">
  238. <template #bodyCell="{ column, record }">
  239. <template v-if="column.dataIndex === 'action'">
  240. <a @click="editAccount(record)">编辑</a>
  241. <!-- <a-divider type="vertical" />
  242. <a-popconfirm title="确定要删除吗?" @confirm="removeUser(record)">
  243. <a-button type="link" danger size="small">删除</a-button>
  244. </a-popconfirm>-->
  245. </template>
  246. <template v-if="column.dataIndex === 'remain'">
  247. {{record.applyNumber-record.applyNumberAlready}}
  248. </template>
  249. </template>
  250. </a-table>
  251. </a-card>
  252. </a-modal>
  253. <a-modal
  254. v-model:visible="editAccountFlag"
  255. :title="formData.id ? '编辑扫码次数' : '添加扫码次数'"
  256. class="custom-modal"
  257. width="800px"
  258. @ok="handleOk"
  259. @cancel="onClose"
  260. >
  261. <a-form ref="formSubmitRef" :model="formData" :rules="formRules" :wrapper-col="wrapperCol" :label-col="labelCol">
  262. <a-form-item label="开始时间:" name="beginTime">
  263. <a-input v-model:value="formData.beginTime" placeholder="请输入提货开始时间" allow-clear disabled/>
  264. </a-form-item>
  265. <a-form-item label="结束时间:" name="endTime">
  266. <a-input v-model:value="formData.endTime" placeholder="请输入提货结束时间" allow-clear disabled/>
  267. </a-form-item>
  268. <a-form-item label="申请数量:" name="applyNumber">
  269. <a-input-number v-model:value="formData.applyNumber" style="width:90%" :precision="0" :min="1" :max="99999" placeholder="请输入申请数量" allow-clear /><span style="margin-left:10px;">次</span>
  270. </a-form-item>
  271. </a-form>
  272. </a-modal>
  273. </template>
  274. <script setup name="bizorder">
  275. import { cloneDeep } from 'lodash-es'
  276. import Form from './form.vue'
  277. import Detail from './detail.vue'
  278. import bizOrderApi from '@/api/biz/bizOrderApi'
  279. import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
  280. import {Modal} from 'ant-design-vue';
  281. import {createVNode} from 'vue';
  282. import QRCode from 'qrcode'
  283. import html2canvas from 'html2canvas'
  284. import userApi from '@/api/sys/userApi'
  285. import downloadUtil from '@/utils/downloadUtil'
  286. import tool from '@/utils/tool'
  287. import Review from './review.vue'
  288. import Flow from './flow.vue'
  289. import bizOrderConfigApi from "@/api/biz/bizOrderConfigApi";
  290. import { required } from '@/utils/formRules'
  291. import End from './end.vue'
  292. const editAccountFlag = ref(false)
  293. const moreFlag = ref(false)
  294. const selectedRecord = ref({})
  295. const CustomerSelectorPlusRef = ref()
  296. const nowRecord = ref()
  297. const tableRef = ref()
  298. const formRef = ref()
  299. const configRef = ref()
  300. const flowRef = ref()
  301. const reviewRef = ref()
  302. const endRef = ref()
  303. const detailRef = ref()
  304. const XnSignNameRef = ref()
  305. const submitLoading = ref(false)
  306. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  307. //查询数据
  308. const searchFormState = ref({})
  309. const searchFormRef = ref()
  310. const orderStatusList = tool.dictList('order_status')
  311. const orderSourceList = tool.dictList('order_source')
  312. // 查询区域显示更多控制
  313. const advanced = ref(false)
  314. const toggleAdvanced = () => {
  315. advanced.value = !advanced.value
  316. }
  317. // 表单数据
  318. const formData = ref({})
  319. const columns = [
  320. {
  321. title: '订单编号',
  322. dataIndex: 'orderNumber',
  323. align:'center',
  324. width: 130
  325. },
  326. {
  327. title: '订单名称',
  328. dataIndex: 'orderName',
  329. align:'center',
  330. width: 130
  331. },
  332. {
  333. title: '客户名称',
  334. dataIndex: 'customerName',
  335. align:'center',
  336. width: 130
  337. },
  338. {
  339. title: '货品名称',
  340. dataIndex: 'goodsName',
  341. align:'center',
  342. width: 130
  343. },
  344. /*{
  345. title: '订单类型',
  346. dataIndex: 'orderType',
  347. align:'center'
  348. },*/
  349. /*{
  350. title: '订单来源',
  351. dataIndex: 'orderSource',
  352. align:'center',
  353. width: 100
  354. },*/
  355. {
  356. title: '提货开始时间',
  357. dataIndex: 'confStartTime',
  358. align:'center',
  359. width: 130
  360. },
  361. {
  362. title: '提货结束时间',
  363. dataIndex: 'confEndTime',
  364. align:'center',
  365. width: 130
  366. },
  367. {
  368. title: '订单状态',
  369. dataIndex: 'orderStatus',
  370. align:'center',
  371. width: 80
  372. },
  373. {
  374. title: '订单重量',
  375. dataIndex: 'orderWeight',
  376. align:'center',
  377. width: 100
  378. },
  379. {
  380. title: '过磅重量',
  381. dataIndex: 'netWeight',
  382. align:'center',
  383. width: 100
  384. },
  385. ]
  386. // 操作栏通过权限判断是否显示
  387. columns.push({
  388. title: '操作',
  389. dataIndex: 'action',
  390. align: 'center',
  391. width: 150
  392. })
  393. const selectedRowKeys = ref([])
  394. // 列表选择配置
  395. const options = {
  396. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  397. alert: {
  398. show: true,
  399. clear: () => {
  400. selectedRowKeys.value = ref([])
  401. }
  402. },
  403. rowSelection: {
  404. onChange: (selectedRowKey, selectedRows) => {
  405. selectedRowKeys.value = selectedRowKey
  406. }
  407. }
  408. }
  409. const loadData = (parameter) => {
  410. const searchFormParam = cloneDeep(searchFormState.value)
  411. return bizOrderApi.bizOrderPage(Object.assign(parameter, searchFormParam)).then((data) => {
  412. return data
  413. })
  414. }
  415. // 重置
  416. const reset = () => {
  417. searchFormRef.value.resetFields()
  418. tableRef.value.refresh(true)
  419. }
  420. //确认
  421. const orderConfirm = (id) =>{
  422. Modal.confirm({
  423. title: '提示',
  424. icon: createVNode(ExclamationCircleOutlined),
  425. content: '是否确认该数据?',
  426. onOk() {
  427. submitLoading.value = true
  428. let params =
  429. {
  430. id: id
  431. }
  432. bizOrderApi
  433. .orderConfirm(params)
  434. .then(() => {
  435. tableRef.value.refresh(true)
  436. })
  437. .finally(() => {
  438. submitLoading.value = false
  439. })
  440. },
  441. onCancel() {}
  442. })
  443. }
  444. //提交
  445. const submit = (id) =>{
  446. Modal.confirm({
  447. title: '提示',
  448. icon: createVNode(ExclamationCircleOutlined),
  449. content: '是否提交该数据?',
  450. onOk() {
  451. submitLoading.value = true
  452. let params =
  453. {
  454. id: id
  455. }
  456. bizOrderApi
  457. .submit(params)
  458. .then(() => {
  459. tableRef.value.refresh(true)
  460. })
  461. .finally(() => {
  462. submitLoading.value = false
  463. })
  464. },
  465. onCancel() {}
  466. })
  467. }
  468. // 删除
  469. const deleteBizOrder = (record) => {
  470. let params = [
  471. {
  472. id: record.id
  473. }
  474. ]
  475. bizOrderApi.bizOrderDelete(params).then(() => {
  476. tableRef.value.refresh(true)
  477. })
  478. }
  479. // 删除
  480. const deleteConfig = (record) => {
  481. Modal.confirm({
  482. title: '确定删除该数据吗?',
  483. icon: createVNode(ExclamationCircleOutlined),
  484. content: '',
  485. onOk() {
  486. submitLoading.value = true
  487. let params = [
  488. {
  489. id: record.id
  490. }
  491. ]
  492. bizOrderApi
  493. .bizOrderDelete(params)
  494. .then(() => {
  495. tableRef.value.refresh(true)
  496. })
  497. .finally(() => {
  498. submitLoading.value = false
  499. })
  500. },
  501. onCancel() {}
  502. })
  503. }
  504. // 批量删除
  505. const deleteBatchBizOrder = (params) => {
  506. bizOrderApi.bizOrderDelete(params).then(() => {
  507. tableRef.value.clearRefreshSelected()
  508. })
  509. }
  510. //二维码
  511. const open = ref(false);
  512. const qrCodeUrl = ref({})
  513. const showModal = (record) => {
  514. nowRecord.value = record
  515. open.value = true;
  516. getQrCode(record)
  517. };
  518. const getQrCode = (record) => {
  519. //QRCode.toDataURL("id:"+record.id+"saleCode:"+record.saleCode, {
  520. let param = {
  521. id:record.id,
  522. orderName:record.orderName
  523. }
  524. QRCode.toDataURL(JSON.stringify(param), {
  525. errorCorrectionLevel: 'H',
  526. margin: 1,
  527. height: 206,
  528. width: 206,
  529. type: '10',
  530. scal: 177,
  531. color: {
  532. dark: '#000' // 二维码背景颜色
  533. },
  534. rendererOpts: {
  535. quality: 0.9
  536. }
  537. })
  538. .then((url) => {
  539. qrCodeUrl.value.codeUrl = url
  540. })
  541. .catch((err) => {
  542. console.error(err)
  543. })
  544. }
  545. const closeQrCode = () => {
  546. open.value = false;
  547. }
  548. // 下载二维码
  549. const downloadFile = () => {
  550. const qrcodeDiv = document.getElementById('qrcode');
  551. html2canvas(qrcodeDiv, {
  552. logging: false,
  553. allowTaint: true,
  554. scale: window.devicePixelRatio,
  555. scrollY: 0,
  556. scrollX: 0,
  557. useCORS: true,
  558. backgroundColor: '#ffffff'
  559. })
  560. .then(function (canvas) {
  561. const a = window.document.createElement('a')
  562. a.href = canvas.toDataURL('image/png')
  563. a.download = '二维码'
  564. a.click()
  565. this.$message.success('正在进行下载保存')
  566. })
  567. .catch((err) => {
  568. console.log(err)
  569. })
  570. }
  571. // 打开角色选择器
  572. const selectCustomer = (record) => {
  573. selectedRecord.value = record
  574. // 查询到已有角色,并转为ids的格式,给角色选择器
  575. CustomerSelectorPlusRef.value.showModel(record.customerId)
  576. }
  577. // 角色选择回调
  578. const customerBack = (value) => {
  579. let params = {
  580. id: selectedRecord.value.id,
  581. customerIdList: []
  582. }
  583. if (value.length > 0) {
  584. value.forEach((item) => {
  585. params.customerIdList.push(item)
  586. })
  587. }
  588. bizOrderApi.bindCustomerId(params).then(() => {
  589. tableRef.value.refresh()
  590. })
  591. }
  592. //导出
  593. const exportTotal = () => {
  594. const searchFormParam = cloneDeep(searchFormState.value)
  595. bizOrderApi.exportRecord(Object.assign(searchFormParam)).then((res)=>{
  596. downloadUtil.resultDownload(res)
  597. })
  598. }
  599. // 签名板组件回调
  600. const signSuccess = (value) => {
  601. const param = {
  602. id:value.id,
  603. orderSign: value.value
  604. }
  605. bizOrderApi.updateOrderSign(param).then(() => {
  606. tableRef.value.refresh(true)
  607. })
  608. }
  609. //结束订单
  610. const endOrder = (record) => {
  611. /*let param = {
  612. id:record.id
  613. }
  614. bizOrderApi.endOrder(param).then((res)=>{
  615. tableRef.value.refresh()
  616. })*/
  617. Modal.confirm({
  618. title: '确定结束该订单吗?',
  619. icon: createVNode(ExclamationCircleOutlined),
  620. content: '',
  621. onOk() {
  622. submitLoading.value = true
  623. let param = {
  624. id:record.id
  625. }
  626. bizOrderApi
  627. .endOrder(param)
  628. .then(() => {
  629. tableRef.value.refresh(true)
  630. })
  631. .finally(() => {
  632. submitLoading.value = false
  633. })
  634. },
  635. onCancel() {}
  636. })
  637. }
  638. const data1 = ref([])
  639. const orderId = ref()
  640. const beginTime = ref()
  641. const endTime = ref()
  642. const formSubmitRef = ref()
  643. //打开扫码次数配置页
  644. const showMore = (record) => {
  645. orderId.value = record.id
  646. beginTime.value = record.confStartTime
  647. endTime.value = record.confEndTime
  648. loadData1()
  649. moreFlag.value = true
  650. }
  651. const loadData1 = () => {
  652. let param={
  653. orderId:orderId.value
  654. }
  655. bizOrderConfigApi.bizOrderConfigPage(param).then((res)=>{
  656. data1.value = res.records
  657. })
  658. }
  659. const columns1 = [
  660. {
  661. title: '提货开始时间',
  662. dataIndex: 'beginTime',
  663. align: 'center',
  664. resizable: true,
  665. ellipsis: true,
  666. width: 130
  667. },
  668. {
  669. title: '提货结束时间',
  670. dataIndex: 'endTime',
  671. align: 'center',
  672. resizable: true,
  673. ellipsis: true,
  674. width: 130
  675. },
  676. {
  677. title: '申请数量',
  678. dataIndex: 'applyNumber',
  679. align: 'center',
  680. resizable: true,
  681. ellipsis: true,
  682. width: 100
  683. },
  684. {
  685. title: '已约数量',
  686. dataIndex: 'applyNumberAlready',
  687. align: 'center',
  688. resizable: true,
  689. ellipsis: true,
  690. width: 100
  691. },
  692. {
  693. title: '可约数量',
  694. dataIndex: 'remain',
  695. align: 'center',
  696. resizable: true,
  697. ellipsis: true,
  698. width: 100
  699. },
  700. ]
  701. columns1.push({
  702. title: '操作',
  703. dataIndex: 'action',
  704. align: 'center',
  705. fixed: 'right',
  706. width: 140,
  707. })
  708. const addAccount = () =>{
  709. formData.value = {}
  710. formData.value.orderId = orderId.value
  711. formData.value.beginTime = beginTime.value
  712. formData.value.endTime = endTime.value
  713. editAccountFlag.value = true
  714. }
  715. const formRules = {
  716. applyNumber: [required('请输入申请数量')],
  717. }
  718. //表单提交
  719. const handleOk = () => {
  720. console.log("handleOk")
  721. formSubmitRef.value.validate().then(() => {
  722. submitLoading.value = true
  723. const formDataParam = cloneDeep(formData.value)
  724. bizOrderConfigApi
  725. .bizOrderConfigSubmitForm(formDataParam, formDataParam.id)
  726. .then(() => {
  727. onClose()
  728. emit('successful')
  729. })
  730. .finally(() => {
  731. submitLoading.value = false
  732. })
  733. })
  734. }
  735. const onClose = () => {
  736. formSubmitRef.value.resetFields()
  737. formData.value = {}
  738. editAccountFlag.value = false
  739. loadData1()
  740. }
  741. const editAccount = (record) => {
  742. formData.value = record
  743. editAccountFlag.value = true
  744. }
  745. const removeUser = (record) => {
  746. let params = [
  747. {
  748. id: record.id
  749. }
  750. ]
  751. bizOrderConfigApi.bizOrderConfigDelete(params).then(() => {
  752. loadData1()
  753. })
  754. }
  755. const onCloseAccount = () => {
  756. moreFlag.value = false
  757. data1.value = []
  758. orderId.value = ''
  759. }
  760. </script>