index.vue 24 KB

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