index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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-container>
  19. <div slot="footer" v-if="formType" class="dialog-footer">
  20. <el-button size="mini" @click="formCancel">取 消</el-button>
  21. <el-button size="mini" @click="formConfirm" type="primary">确定</el-button>
  22. </div>
  23. </el-dialog>
  24. </div>
  25. </template-page>
  26. </template>
  27. <script>
  28. import TemplatePage from '@/components/template/template-page-1.vue'
  29. import import_mixin from '@/components/template/import_mixin.js'
  30. import { increOrderSettleList, increOrderSettleListExport, increOrderSettleDetail, increOrderSettleConfirm, increOrderSettleRefund } from "@/api/orderSettleManag.js"
  31. import ImageUpload from '@/components/file-upload'
  32. export default {
  33. props: {
  34. storageType: {
  35. type: String,
  36. default: ""
  37. }
  38. },
  39. components: { TemplatePage, ImageUpload },
  40. mixins: [import_mixin],
  41. data() {
  42. return {
  43. // 事件组合
  44. optionsEvensGroup: [[
  45. [
  46. {
  47. name: '批量结算',
  48. click: () => {
  49. if (this.recordSelected.length === 0) {
  50. this.$message.warning('请勾选订单')
  51. return
  52. }
  53. increOrderSettleConfirm(this.recordSelected.map(item => item.id)).then(res => {
  54. this.$message({ type: 'success', message: `成功!` })
  55. this.$refs.pageRef.refreshList()
  56. })
  57. }
  58. },
  59. ]
  60. ]],
  61. // 表格属性
  62. tableAttributes: {
  63. // 启用勾选列
  64. selectColumn: true,
  65. selectable: this.selectable
  66. },
  67. // 表格事件
  68. tableEvents: {
  69. 'selection-change': this.selectionChange
  70. },
  71. // 勾选选中数据
  72. recordSelected: [],
  73. formTypeName: ["查看", "结算"],
  74. formType: -1,
  75. formData: {
  76. pgIncreItems: []
  77. },
  78. formDialog: false,
  79. }
  80. },
  81. computed: {
  82. // 更多参数
  83. moreParameters() {
  84. return []
  85. },
  86. formItems() {
  87. return [{
  88. md: 24,
  89. isShow: true,
  90. name: 'slot-component',
  91. formItemAttributes: {
  92. label: '',
  93. prop: '',
  94. 'label-width': '0px'
  95. },
  96. render: (h, { props, onInput }) => {
  97. var { value } = props
  98. return (
  99. <div>
  100. <el-descriptions border title="" column={2} colon={false} labelStyle={{ width: '10%' }} contentStyle={{ width: '40%' }}>
  101. <el-descriptions-item label="所属商户">
  102. {this.formData.companyWechatName}
  103. </el-descriptions-item>
  104. <el-descriptions-item label="销售网点">
  105. {this.formData.websitName}
  106. </el-descriptions-item>
  107. <el-descriptions-item label="订单单号" >
  108. {this.formData.id}
  109. </el-descriptions-item>
  110. <el-descriptions-item label="师傅姓名" >
  111. {this.formData.workerName}
  112. </el-descriptions-item>
  113. <el-descriptions-item label="师傅联系电话">
  114. {this.formData.workerMobile}
  115. </el-descriptions-item>
  116. <el-descriptions-item label="师傅身份证号">
  117. {this.formData.workerIdcard}
  118. </el-descriptions-item>
  119. <el-descriptions-item label="客户姓名" >
  120. {this.formData.userName}
  121. </el-descriptions-item>
  122. <el-descriptions-item label="客户电话" >
  123. {this.formData.userMobile}
  124. </el-descriptions-item>
  125. <el-descriptions-item label="详细地址">
  126. {this.formData.userAddress}
  127. </el-descriptions-item>
  128. <el-descriptions-item label="内机条码">
  129. {this.formData.insideCode}
  130. </el-descriptions-item>
  131. <el-descriptions-item label="服务单号" >
  132. {this.formData.serviceNo}
  133. </el-descriptions-item>
  134. <el-descriptions-item label="发票价格" >
  135. {this.formData.invoiceAmount}
  136. </el-descriptions-item>
  137. <el-descriptions-item label="发票时间">
  138. {this.formData.invoiceTime}
  139. </el-descriptions-item>
  140. <el-descriptions-item label="服务截止时间">
  141. {this.formData.serviceEndTime}
  142. </el-descriptions-item>
  143. <el-descriptions-item label="创建人" >
  144. {this.formData.createBy}
  145. </el-descriptions-item>
  146. <el-descriptions-item label="创建时间" >
  147. {this.formData.createTime}
  148. </el-descriptions-item>
  149. <el-descriptions-item label="支付状态">
  150. {({ "EXPIRE": "过期", "CANCEL": "取消", "PAID": "已支付", "WAIT": "待支付", "REFUND": "已退款" })[this.formData.payStatus] || ""}
  151. </el-descriptions-item>
  152. <el-descriptions-item label="支付方式">
  153. {({ 1: "扫码支付", 2: "代客支付" })[this.formData.payType] || ""}
  154. </el-descriptions-item>
  155. <el-descriptions-item label="支付订单号" >
  156. {this.formData.payNo}
  157. </el-descriptions-item>
  158. <el-descriptions-item label="支付时间" >
  159. {this.formData.payTime}
  160. </el-descriptions-item>
  161. <el-descriptions-item label="微信流水号">
  162. {this.formData.transcationId}
  163. </el-descriptions-item>
  164. <el-descriptions-item label="师傅销售佣金">
  165. {this.formData.workerAmount}
  166. </el-descriptions-item>
  167. <el-descriptions-item label="结算人员" >
  168. {this.formData.updateBy}
  169. </el-descriptions-item>
  170. <el-descriptions-item label="操作时间" >
  171. {this.formData.updateTime}
  172. </el-descriptions-item>
  173. </el-descriptions>
  174. </div>
  175. )
  176. }
  177. }]
  178. },
  179. formItemsList() {
  180. return [{
  181. md: 24,
  182. isShow: true,
  183. name: 'slot-component',
  184. formItemAttributes: {
  185. label: '',
  186. prop: '',
  187. 'label-width': '0px'
  188. },
  189. render: (h, { props, onInput }) => {
  190. var { value } = props
  191. return (
  192. <zj-table
  193. columns={[{
  194. columnAttributes: {
  195. label: '服务类型',
  196. prop: 'type'
  197. },
  198. render: (h, { row, column, index }) => {
  199. return <div style="padding: 0 10px">
  200. {({ 1: "延保", 2: "清洗" })[row.type] || ""}
  201. </div>
  202. }
  203. },
  204. {
  205. columnAttributes: {
  206. label: '使用类型',
  207. prop: 'usedType'
  208. },
  209. render: (h, { row, column, index }) => {
  210. return <div style="padding: 0 10px">
  211. {({ COUNT: "使用次数", YEAR: "使用年限" })[row.usedType] || ""}
  212. </div>
  213. }
  214. }, {
  215. columnAttributes: {
  216. label: '品牌',
  217. prop: 'brandName'
  218. }
  219. },
  220. {
  221. columnAttributes: {
  222. label: '产品大类',
  223. prop: 'mainName'
  224. }
  225. },
  226. {
  227. columnAttributes: {
  228. label: '服务内容',
  229. prop: 'content'
  230. }
  231. },
  232. {
  233. columnAttributes: {
  234. label: '服务金额(元)',
  235. prop: 'amount'
  236. }
  237. },
  238. {
  239. columnAttributes: {
  240. label: '使用限值',
  241. prop: 'limitNum'
  242. }
  243. },
  244. {
  245. columnAttributes: {
  246. label: '总手续费',
  247. prop: 'commissionAmount'
  248. }
  249. },
  250. {
  251. columnAttributes: {
  252. label: '师傅分成金额',
  253. prop: 'workerAmount'
  254. }
  255. },
  256. {
  257. columnAttributes: {
  258. label: '网点分成金额',
  259. prop: 'websitAmount'
  260. }
  261. }]}
  262. tableData={[{ ...(this.formData.increItem || {}), ...(this.formData.incre || {}), commissionAmount: this.formData.commissionAmount }]}
  263. tableAttributes={{
  264. size: 'mini',
  265. border: true,
  266. }} />
  267. )
  268. }
  269. }]
  270. },
  271. formItemsImgs() {
  272. return [{
  273. md: 24,
  274. name: 'slot-component',
  275. formItemAttributes: {
  276. label: '',
  277. prop: '',
  278. 'label-width': '0px'
  279. },
  280. render: (h, { props, onInput }) => {
  281. return (
  282. <ImageUpload
  283. fileList={
  284. [{ key: "insideCodeImg", name: "insideCodeImg" }, { key: "machineImg", name: "机器铭牌图片" }, { key: "buyCertImg", name: "购机凭证图片" }].map((item) => ({ url: this.formData[item.key], name: item.name }))
  285. }
  286. limit={1000}
  287. isEdit={false}
  288. viewOnline={false}
  289. download={false}
  290. showName={true}
  291. />
  292. )
  293. }
  294. }]
  295. },
  296. },
  297. methods: {
  298. selectable(row, index) {
  299. return ["PAID"].includes(Object.entries(row.selectMapData.payStatus).find(([key, val]) => val == row.payStatus)?.[0]) &&
  300. ["ING"].includes(Object.entries(row.selectMapData.settleStatus).find(([key, val]) => val == row.settleStatus)?.[0])
  301. },
  302. // 列表请求函数
  303. getList: increOrderSettleList,
  304. // 列表导出函数
  305. exportList: increOrderSettleListExport,
  306. // 表格列解析渲染数据更改
  307. columnParsing(item, defaultData) {
  308. if (item.jname === 'residuNum') {
  309. defaultData.render = (h, { row, index, column }) => {
  310. return (
  311. <div style="padding:0 6px;cursor: pointer;">
  312. {row["increType"] != 1 ? row["residuNum"] : ""}
  313. </div>
  314. )
  315. }
  316. }
  317. if (item.jname === 'serviceEndTime') {
  318. defaultData.render = (h, { row, index, column }) => {
  319. return (
  320. <div style="padding:0 6px;cursor: pointer;">
  321. {row[column.columnAttributes.prop] ? row[column.columnAttributes.prop].split(" ")[0] : ""}
  322. </div>
  323. )
  324. }
  325. }
  326. return defaultData
  327. },
  328. // 监听勾选变化
  329. selectionChange(data) {
  330. this.recordSelected = data
  331. },
  332. // 操作按钮
  333. operation(h, { row, index, column }) {
  334. return (
  335. <div class='operation-btns'>
  336. <el-button type="text" onClick={() => {
  337. this.formType = 0
  338. this.getDetail(row.id)
  339. }}>查看</el-button>
  340. {["PAID","REFUND"].includes(row.payStatus) ? (
  341. <el-button type="text" onClick={() => {
  342. this.$router.push({
  343. name: "workOrderPool",
  344. query: {
  345. pgIncreItemId: row.id,
  346. }
  347. })
  348. }}>服务单明细</el-button>
  349. ) : null}
  350. {["PAID"].includes(row.payStatus) && ["ING"].includes(row.settleStatus) ? (
  351. <el-popconfirm
  352. title={`是否确定退款?`}
  353. onConfirm={() => {
  354. increOrderSettleRefund({ id: row.id }).then(res => {
  355. this.$message({ type: 'success', message: `退款成功!` })
  356. this.$refs.pageRef.refreshList()
  357. })
  358. }}
  359. >
  360. <el-button type="text" slot="reference">退款</el-button>
  361. </el-popconfirm>
  362. ) : null}
  363. {["PAID"].includes(row.payStatus) && ["ING"].includes(row.settleStatus) ? (
  364. <el-button type="text" onClick={() => {
  365. this.formType = 1
  366. this.getDetail(row.id)
  367. }}>结算</el-button>
  368. ) : null}
  369. </div>
  370. )
  371. },
  372. getDetail(id) {
  373. increOrderSettleDetail({ id }).then(res => {
  374. Object.assign(this.formData, res.data)
  375. this.openForm()
  376. })
  377. },
  378. openForm() {
  379. this.formDialog = true
  380. },
  381. // 关闭弹窗
  382. formCancel() {
  383. this.$refs.formRef.$refs.inlineForm.clearValidate()
  384. this.$data.formData = this.$options.data().formData
  385. this.formDialog = false
  386. },
  387. formConfirm() {
  388. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  389. if (valid) {
  390. increOrderSettleConfirm([this.formData.id]).then(res => {
  391. this.$message({ type: 'success', message: `操作成功!` })
  392. this.formCancel()
  393. this.$refs.pageRef.refreshList()
  394. })
  395. }
  396. })
  397. },
  398. }
  399. }
  400. </script>
  401. <style lang="scss">
  402. .redbordererr {
  403. .el-form-item {
  404. margin: 0 !important;
  405. overflow: hidden;
  406. }
  407. }
  408. </style>