offline.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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 v-if="addFormDialog" title="客户信息" label-width="80px" :form-data="addFormData" :form-items="basicInfo">
  35. </zj-form-module>
  36. <zj-form-module v-if="addFormDialog" title="服务信息" label-width="80px" :form-data="addFormData" :form-items="serviceInfo">
  37. </zj-form-module>
  38. <zj-form-module v-if="addFormDialog" 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. if(this.$refs?.payQRCode?.innerHTML){
  220. this.$refs.payQRCode.innerHTML = '';
  221. }
  222. this.$nextTick(() => {
  223. new QRCode(this.$refs.payQRCode, {
  224. text: res.data.codeUrl,
  225. width: 200,
  226. height: 200,
  227. colorDark: "#333333", // 二维码颜色
  228. colorLight: "#ffffff", // 二维码背景色
  229. correctLevel: QRCode.CorrectLevel.L // 容错率,L/M/H
  230. });
  231. this.wxpaygetDetail(id)
  232. });
  233. })
  234. },
  235. wxpaygetDetail(id) {
  236. if (this.wxpayTimeId) {
  237. clearTimeout(this.wxpayTimeId)
  238. }
  239. this.wxpayTimeId = setTimeout(() => {
  240. increOrderSettleDetail({ id }).then(res => {
  241. if (res.data.payStatus == "PAID" && res.data.payType == 1) {
  242. this.codeUrl = ""
  243. this.addFormCancel()
  244. } else {
  245. this.wxpaygetDetail(id)
  246. }
  247. })
  248. }, 1000)
  249. },
  250. // 列表请求函数
  251. getList(p, cb) {
  252. var pam = JSON.parse(JSON.stringify(p))
  253. try {
  254. if (pam.flag) {
  255. pam.params.push({ "param": "a.flag", "compare": "=", "value": pam.flag })
  256. }
  257. pam.params.push({ "param": "a.order_channel", "compare": "=", "value": "SELF" })
  258. cb && cb(pam)
  259. return increOrderSettleList(pam)
  260. } catch (err) {
  261. }
  262. },
  263. // 列表导出函数
  264. exportList: increOrderSettleListExport,
  265. // 表格列解析渲染数据更改
  266. columnParsing(item, defaultData) {
  267. if (item.jname === 'residuNum') {
  268. defaultData.render = (h, { row, index, column }) => {
  269. return (
  270. <div style="padding:0 6px;cursor: pointer;">
  271. {row["increType"] != 1 ? row["residuNum"] : ""}
  272. </div>
  273. )
  274. }
  275. }
  276. if (item.jname === 'serviceEndTime') {
  277. defaultData.render = (h, { row, index, column }) => {
  278. return (
  279. <div style="padding:0 6px;cursor: pointer;">
  280. {row[column.columnAttributes.prop] ? row[column.columnAttributes.prop].split(" ")[0] : ""}
  281. </div>
  282. )
  283. }
  284. }
  285. return defaultData
  286. },
  287. // 表格操作列
  288. operation() {
  289. return this.operationBtn({
  290. detail: {
  291. btnType: 'text',
  292. click: ({ row, index, column }) => {
  293. this.formType = 0
  294. this.getDetail(row.id)
  295. }
  296. },
  297. orderDetail: {
  298. btnType: 'text',
  299. conditions: ({ row, index, column }) => {
  300. return ["PAID", "REFUND"].includes(row.payStatus)
  301. },
  302. click: ({ row, index, column }) => {
  303. this.$router.push({
  304. name: 'workOrderPool',
  305. params: {
  306. pageName: row.id,
  307. pageType: 'pgIncreItemId',
  308. pageCode: row.id,
  309. },
  310. })
  311. }
  312. },
  313. examine: {
  314. btnType: 'text',
  315. conditions: ({ row, index, column }) => {
  316. return row.flag == "WAIT"
  317. },
  318. click: ({ row, index, column }) => {
  319. this.formType = 1
  320. this.formDshType = true
  321. this.getDetail(row.id)
  322. }
  323. },
  324. })
  325. },
  326. getDetail(id) {
  327. increOrderSettleDetail({ id }).then(res => {
  328. Object.assign(this.formData, res.data)
  329. this.openForm()
  330. })
  331. },
  332. openForm() {
  333. this.formDialog = true
  334. },
  335. // 关闭弹窗
  336. formCancel() {
  337. this.formDshType = false
  338. this.$refs?.formRef?.$refs?.inlineForm?.clearValidate()
  339. this.$data.formData = this.$options.data().formData
  340. this.formDialog = false
  341. },
  342. openAddForm() {
  343. this.formDialog = true
  344. },
  345. shenhexinxi() {
  346. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  347. if (valid) {
  348. increOrderSettleExamine({ ...this.formData, flag: this.formData.flagSh }).then(res => {
  349. this.$message({ type: 'success', message: `审核完成!` })
  350. this.formCancel()
  351. this.$refs?.pageRef?.refreshList()
  352. })
  353. }
  354. })
  355. },
  356. addFormCancel() {
  357. this.formDshType = false
  358. this.$refs?.addFormRef?.$refs?.inlineForm?.clearValidate()
  359. this.$data.addFormData = this.$options.data().addFormData
  360. this.addFormDialog = false
  361. },
  362. addFormOpen() {
  363. this.getincreOrderSettleGetBrand()
  364. this.addFormDialog = true
  365. },
  366. formConfirm() {
  367. this.$refs.addFormRef.validate((valid, invalidFields, errLabels) => {
  368. if (valid) {
  369. increOrderSettleAdd({
  370. ...this.addFormData,
  371. "serviceEndTime": this.addFormData.serviceEndTime + " 23:59:59",
  372. "buyCertImg": this.addFormData.buyCertImg.map(item => item.url).join(","),
  373. "insideCodeImg": this.addFormData.insideCodeImg.map(item => item.url).join(","),
  374. "machineImg": this.addFormData.machineImg.map(item => item.url).join(","),
  375. }).then(res => {
  376. this.$message({ type: 'success', message: `新增成功!` })
  377. this.$refs?.pageRef?.refreshList()
  378. this.addFormCancel()
  379. // if (res.data.payStatus == "WAIT" && res.data.payType == 1) {
  380. // this.wxPay(res.data.id)
  381. // } else {
  382. // this.addFormCancel()
  383. // }
  384. })
  385. }
  386. })
  387. },
  388. }
  389. }
  390. </script>
  391. <style lang="scss">
  392. .redbordererr {
  393. .el-form-item {
  394. margin: 0 !important;
  395. overflow: hidden;
  396. }
  397. }
  398. </style>