offline.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :get-list="getList"
  5. :exportList="exportList"
  6. :table-attributes="tableAttributes"
  7. :table-events="tableEvents"
  8. :moreParameters="moreParameters"
  9. :column-parsing="columnParsing"
  10. :operation="operation()"
  11. :operationColumnWidth="200"
  12. :optionsEvensGroup="optionsEvensGroup"
  13. :defaultSearchData="defaultSearchData"
  14. >
  15. <div class="cartographer">
  16. <el-dialog
  17. :title="formTypeName[formType]"
  18. width="100%"
  19. :modal="false"
  20. :visible.sync="formDialog"
  21. :before-close="formCancel"
  22. >
  23. <zj-form-container v-if="formDialog" ref="formRef" :form-data="formData" :styleSwitch="false">
  24. <zj-form-module
  25. title="基础信息"
  26. label-width="120px"
  27. :showPackUp="false"
  28. :form-data="formData"
  29. :form-items="formItems"
  30. >
  31. </zj-form-module>
  32. <zj-form-module
  33. title="订单信息"
  34. label-width="120px"
  35. :showPackUp="false"
  36. :form-data="formData"
  37. :form-items="formItemsList"
  38. >
  39. </zj-form-module>
  40. <zj-form-module
  41. title="附件图片"
  42. label-width="120px"
  43. :showPackUp="false"
  44. :form-data="formData"
  45. :form-items="formItemsImgs"
  46. >
  47. </zj-form-module>
  48. <zj-form-module
  49. v-if="formType == 1"
  50. title="审核信息"
  51. label-width="120px"
  52. :showPackUp="false"
  53. :form-data="formData"
  54. :form-items="examineInfo"
  55. >
  56. </zj-form-module>
  57. </zj-form-container>
  58. <div v-if="formType == 1 && formDshType" slot="footer" class="dialog-footer">
  59. <el-button size="mini" type="primary" @click="shenhexinxi">审核</el-button>
  60. </div>
  61. <div
  62. v-if="formType == 0 && formData.flag == 'OK' && formData.payStatus == 'WAIT' && formData.payType == 1"
  63. slot="footer"
  64. class="dialog-footer"
  65. >
  66. <el-button
  67. size="mini"
  68. type="primary"
  69. @click="
  70. () => {
  71. wxPay(formData.id)
  72. }
  73. "
  74. >微信支付</el-button
  75. >
  76. </div>
  77. </el-dialog>
  78. </div>
  79. <div class="cartographer">
  80. <el-dialog title="新增" width="100%" :modal="false" :visible.sync="addFormDialog" :before-close="addFormCancel">
  81. <zj-form-container v-if="addFormDialog" ref="addFormRef" :form-data="addFormData">
  82. <zj-form-module
  83. v-if="addFormDialog"
  84. title="客户信息"
  85. label-width="80px"
  86. :form-data="addFormData"
  87. :form-items="basicInfo"
  88. >
  89. </zj-form-module>
  90. <zj-form-module
  91. v-if="addFormDialog"
  92. title="服务信息"
  93. label-width="80px"
  94. :form-data="addFormData"
  95. :form-items="serviceInfo"
  96. >
  97. </zj-form-module>
  98. <zj-form-module
  99. v-if="addFormDialog"
  100. title="产品信息"
  101. label-width="80px"
  102. :form-data="addFormData"
  103. :form-items="productInfo"
  104. >
  105. </zj-form-module>
  106. </zj-form-container>
  107. <div slot="footer" class="dialog-footer">
  108. <el-button size="mini" type="primary" @click="formConfirm">提交</el-button>
  109. </div>
  110. </el-dialog>
  111. </div>
  112. <el-dialog
  113. title="微信支付"
  114. :visible.sync="isPay"
  115. width="50%"
  116. :close-on-click-modal="false"
  117. :modal-append-to-body="false"
  118. @close="codeUrl = ''"
  119. >
  120. <h3 style="text-align: center">扫二维码支付</h3>
  121. <div ref="payQRCode" style="display: flex; justify-content: center" />
  122. <div style="color: #ea8000; text-align: center; margin-top: 20px">注:支付成功后,方可操作!</div>
  123. <div style="display: flex; justify-content: flex-end; margin-top: 30px">
  124. <el-button size="mini" type="text" @click="codeUrl = ''">取消</el-button>
  125. </div>
  126. </el-dialog>
  127. </template-page>
  128. </template>
  129. <script>
  130. import TemplatePage from '@/components/template/template-page-1.vue'
  131. import import_mixin from '@/components/template/import_mixin.js'
  132. import {
  133. increOrderSettleExamine,
  134. increOrderSettleGetBrand,
  135. increOrderSettleGeneratePayCode,
  136. increOrderSettleList,
  137. increOrderSettleListExport,
  138. increOrderSettleAdd,
  139. increOrderSettleDetail,
  140. increOrderSettleConfirm,
  141. increOrderSettleRefund
  142. } from '@/api/orderSettleManag.js'
  143. import operation_mixin from '@/components/template/operation_mixin.js'
  144. import formItems from '../mixins/formItems.js'
  145. import basicInfo from '../mixins/basicInfo.js'
  146. import serviceInfo from '../mixins/serviceInfo.js'
  147. import productInfo from '../mixins/productInfo.js'
  148. import examineInfo from '../mixins/examineInfo.js'
  149. import QRCode from 'qrcodejs2'
  150. export default {
  151. props: {
  152. storageType: {
  153. type: String,
  154. default: ''
  155. }
  156. },
  157. components: { TemplatePage },
  158. mixins: [import_mixin, operation_mixin, formItems, basicInfo, serviceInfo, productInfo, examineInfo],
  159. data() {
  160. return {
  161. isPay: false,
  162. codeUrl: '',
  163. // 表格属性
  164. tableAttributes: {},
  165. // 表格事件
  166. tableEvents: {},
  167. // 勾选选中数据
  168. recordSelected: [],
  169. formTypeName: ['查看', '审批'],
  170. formType: -1,
  171. formData: {
  172. flagSh: '',
  173. flag: '',
  174. examineRemark: '',
  175. pgIncreItems: []
  176. },
  177. formDialog: false,
  178. addFormDialog: false,
  179. formDshType: false,
  180. defaultSearchData: [],
  181. addFormData: {
  182. shiyongleixing: '按使用年限',
  183. amount: '',
  184. brandId: '',
  185. brandName: '',
  186. buyCertImg: [],
  187. commissionAmount: '',
  188. companyWechatId: '',
  189. companyWechatName: '',
  190. createBy: '',
  191. createTime: '',
  192. examineBy: '',
  193. examineRemark: '',
  194. examineTime: '',
  195. flag: '',
  196. id: '',
  197. increContent: '',
  198. increType: '',
  199. insideCode: '',
  200. insideCodeImg: [],
  201. insureTime: '',
  202. invoiceAmount: '',
  203. invoiceTime: '',
  204. limitNum: '',
  205. machineImg: [],
  206. mainId: '',
  207. mainImg: '',
  208. mainName: '',
  209. orderChannel: '',
  210. payNo: '',
  211. payStatus: '',
  212. payTime: '',
  213. payType: '',
  214. pgIncreId: '',
  215. pgIncreItemId: '',
  216. refundNo: '',
  217. refundTime: '',
  218. remark: '',
  219. residuNum: '',
  220. serviceEndTime: '',
  221. serviceNo: '',
  222. settleRemark: '',
  223. settleStatus: '',
  224. transcationId: '',
  225. updateBy: '',
  226. updateTime: '',
  227. userAddress: '',
  228. userAddressId: '',
  229. userMobile: '',
  230. userName: '',
  231. websitAmount: '',
  232. websitId: '',
  233. websitName: '',
  234. workerAmount: '',
  235. workerId: '',
  236. workerIdcard: '',
  237. workerMobile: '',
  238. workerName: '',
  239. workerOpenId: ''
  240. }
  241. }
  242. },
  243. computed: {
  244. // 事件组合
  245. optionsEvensGroup() {
  246. return [
  247. [
  248. [
  249. this.optionsEvensAuth('add', {
  250. click: () => {
  251. this.addFormOpen()
  252. }
  253. })
  254. ]
  255. ]
  256. ]
  257. },
  258. // 更多参数
  259. moreParameters() {
  260. return [
  261. {
  262. name: '审批状态',
  263. key: 'flag',
  264. value: this?.$route?.params?.pageCode || '',
  265. conditions: [
  266. {
  267. label: '全部',
  268. value: ''
  269. },
  270. {
  271. label: '待审核',
  272. value: 'WAIT'
  273. },
  274. {
  275. label: '通过',
  276. value: 'OK'
  277. },
  278. {
  279. label: '失败',
  280. value: 'FAIL'
  281. }
  282. ]
  283. }
  284. ]
  285. }
  286. },
  287. watch: {
  288. codeUrl(newVal) {
  289. this.isPay = !!newVal
  290. if (!this.isPay) {
  291. if (this.wxpayTimeId) {
  292. clearTimeout(this.wxpayTimeId)
  293. }
  294. this.formCancel()
  295. this.addFormCancel()
  296. this.$refs?.pageRef?.refreshList()
  297. }
  298. }
  299. },
  300. created() {
  301. if (this.pageCode && !~['WAIT', 'OK', 'FAIL'].indexOf(this.pageCode)) {
  302. this.defaultSearchData = [{ param: 'a.id', compare: '=', value: this.pageCode, label: '订单单号' }]
  303. }
  304. },
  305. methods: {
  306. wxPay(id) {
  307. increOrderSettleGeneratePayCode({ id }).then(res => {
  308. this.codeUrl = res.data.codeUrl
  309. if (this.$refs?.payQRCode?.innerHTML) {
  310. this.$refs.payQRCode.innerHTML = ''
  311. }
  312. this.$nextTick(() => {
  313. new QRCode(this.$refs.payQRCode, {
  314. text: res.data.codeUrl,
  315. width: 200,
  316. height: 200,
  317. colorDark: '#333333', // 二维码颜色
  318. colorLight: '#ffffff', // 二维码背景色
  319. correctLevel: QRCode.CorrectLevel.L // 容错率,L/M/H
  320. })
  321. this.wxpaygetDetail(id)
  322. })
  323. })
  324. },
  325. wxpaygetDetail(id) {
  326. if (this.wxpayTimeId) {
  327. clearTimeout(this.wxpayTimeId)
  328. }
  329. this.wxpayTimeId = setTimeout(() => {
  330. increOrderSettleDetail({ id }).then(res => {
  331. if (res.data.payStatus == 'PAID' && res.data.payType == 1) {
  332. this.codeUrl = ''
  333. this.addFormCancel()
  334. } else {
  335. this.wxpaygetDetail(id)
  336. }
  337. })
  338. }, 1000)
  339. },
  340. // 列表请求函数
  341. getList(p, cb) {
  342. var pam = JSON.parse(JSON.stringify(p))
  343. try {
  344. if (pam.flag) {
  345. pam.params.push({ param: 'a.flag', compare: '=', value: pam.flag })
  346. }
  347. pam.params.push({ param: 'a.order_channel', compare: '=', value: 'SELF' })
  348. cb && cb(pam)
  349. return increOrderSettleList(pam)
  350. } catch (err) {}
  351. },
  352. // 列表导出函数
  353. exportList: increOrderSettleListExport,
  354. // 表格列解析渲染数据更改
  355. columnParsing(item, defaultData) {
  356. if (item.jname === 'residuNum') {
  357. defaultData.render = (h, { row, index, column }) => {
  358. return <div style="padding:0 6px;cursor: pointer;">{row['increType'] != 1 ? row['residuNum'] : ''}</div>
  359. }
  360. }
  361. if (item.jname === 'serviceEndTime') {
  362. defaultData.render = (h, { row, index, column }) => {
  363. return (
  364. <div style="padding:0 6px;cursor: pointer;">
  365. {row[column.columnAttributes.prop] ? row[column.columnAttributes.prop].split(' ')[0] : ''}
  366. </div>
  367. )
  368. }
  369. }
  370. return defaultData
  371. },
  372. // 表格操作列
  373. operation() {
  374. return this.operationBtn({
  375. detail: {
  376. btnType: 'text',
  377. click: ({ row, index, column }) => {
  378. this.formType = 0
  379. this.getDetail(row.id)
  380. }
  381. },
  382. orderDetail: {
  383. btnType: 'text',
  384. conditions: ({ row, index, column }) => {
  385. return ['PAID', 'REFUND'].includes(row.payStatus)
  386. },
  387. click: ({ row, index, column }) => {
  388. this.$router.push({
  389. name: window.isWorkOrderPoolPath,
  390. params: {
  391. pageName: row.id,
  392. pageType: 'pgIncreItemId',
  393. pageCode: row.id
  394. }
  395. })
  396. }
  397. },
  398. examine: {
  399. btnType: 'text',
  400. conditions: ({ row, index, column }) => {
  401. return row.flag == 'WAIT'
  402. },
  403. click: ({ row, index, column }) => {
  404. this.formType = 1
  405. this.formDshType = true
  406. this.getDetail(row.id)
  407. }
  408. }
  409. })
  410. },
  411. getDetail(id) {
  412. increOrderSettleDetail({ id }).then(res => {
  413. Object.assign(this.formData, res.data)
  414. this.openForm()
  415. })
  416. },
  417. openForm() {
  418. this.formDialog = true
  419. },
  420. // 关闭弹窗
  421. formCancel() {
  422. this.formDshType = false
  423. this.$refs?.formRef?.$refs?.inlineForm?.clearValidate()
  424. this.$data.formData = this.$options.data().formData
  425. this.formDialog = false
  426. },
  427. openAddForm() {
  428. this.formDialog = true
  429. },
  430. shenhexinxi() {
  431. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  432. if (valid) {
  433. increOrderSettleExamine({ ...this.formData, flag: this.formData.flagSh }).then(res => {
  434. this.$message({ type: 'success', message: `审核完成!` })
  435. this.formCancel()
  436. this.$refs?.pageRef?.refreshList()
  437. })
  438. }
  439. })
  440. },
  441. addFormCancel() {
  442. this.formDshType = false
  443. this.$refs?.addFormRef?.$refs?.inlineForm?.clearValidate()
  444. this.$data.addFormData = this.$options.data().addFormData
  445. this.addFormDialog = false
  446. },
  447. addFormOpen() {
  448. this.getincreOrderSettleGetBrand()
  449. this.addFormDialog = true
  450. },
  451. formConfirm() {
  452. this.$refs.addFormRef.validate((valid, invalidFields, errLabels) => {
  453. if (valid) {
  454. increOrderSettleAdd({
  455. ...this.addFormData,
  456. serviceEndTime: this.addFormData.serviceEndTime + ' 23:59:59',
  457. buyCertImg: this.addFormData.buyCertImg.map(item => item.url).join(','),
  458. insideCodeImg: this.addFormData.insideCodeImg.map(item => item.url).join(','),
  459. machineImg: this.addFormData.machineImg.map(item => item.url).join(',')
  460. }).then(res => {
  461. this.$message({ type: 'success', message: `新增成功!` })
  462. this.$refs?.pageRef?.refreshList()
  463. this.addFormCancel()
  464. // if (res.data.payStatus == "WAIT" && res.data.payType == 1) {
  465. // this.wxPay(res.data.id)
  466. // } else {
  467. // this.addFormCancel()
  468. // }
  469. })
  470. }
  471. })
  472. }
  473. }
  474. }
  475. </script>
  476. <style lang="scss">
  477. .redbordererr {
  478. .el-form-item {
  479. margin: 0 !important;
  480. overflow: hidden;
  481. }
  482. }
  483. </style>