offline.vue 13 KB

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