offline.vue 13 KB

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