index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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={[{
  263. ...(this.formData.increItem || {}),
  264. ...(this.formData.incre || {}),
  265. workerAmount: this.formData.workerAmount,
  266. websitAmount: this.formData.websitAmount,
  267. commissionAmount: this.formData.commissionAmount
  268. }]}
  269. tableAttributes={{
  270. size: 'mini',
  271. border: true,
  272. }} />
  273. )
  274. }
  275. }]
  276. },
  277. formItemsImgs() {
  278. return [{
  279. md: 24,
  280. name: 'slot-component',
  281. formItemAttributes: {
  282. label: '',
  283. prop: '',
  284. 'label-width': '0px'
  285. },
  286. render: (h, { props, onInput }) => {
  287. return (
  288. <ImageUpload
  289. fileList={
  290. [{ key: "insideCodeImg", name: "内机条码" }, { key: "machineImg", name: "机器铭牌图片" }, { key: "buyCertImg", name: "购机凭证图片" }].map((item) => ({ url: this.formData[item.key], name: item.name }))
  291. }
  292. limit={1000}
  293. isEdit={false}
  294. viewOnline={false}
  295. download={false}
  296. showName={true}
  297. />
  298. )
  299. }
  300. }]
  301. },
  302. },
  303. methods: {
  304. selectable(row, index) {
  305. return ["PAID"].includes(Object.entries(row.selectMapData.payStatus).find(([key, val]) => val == row.payStatus)?.[0]) &&
  306. ["ING"].includes(Object.entries(row.selectMapData.settleStatus).find(([key, val]) => val == row.settleStatus)?.[0])
  307. },
  308. // 列表请求函数
  309. getList: increOrderSettleList,
  310. // 列表导出函数
  311. exportList: increOrderSettleListExport,
  312. // 表格列解析渲染数据更改
  313. columnParsing(item, defaultData) {
  314. if (item.jname === 'residuNum') {
  315. defaultData.render = (h, { row, index, column }) => {
  316. return (
  317. <div style="padding:0 6px;cursor: pointer;">
  318. {row["increType"] != 1 ? row["residuNum"] : ""}
  319. </div>
  320. )
  321. }
  322. }
  323. if (item.jname === 'serviceEndTime') {
  324. defaultData.render = (h, { row, index, column }) => {
  325. return (
  326. <div style="padding:0 6px;cursor: pointer;">
  327. {row[column.columnAttributes.prop] ? row[column.columnAttributes.prop].split(" ")[0] : ""}
  328. </div>
  329. )
  330. }
  331. }
  332. return defaultData
  333. },
  334. // 监听勾选变化
  335. selectionChange(data) {
  336. this.recordSelected = data
  337. },
  338. // 操作按钮
  339. operation(h, { row, index, column }) {
  340. return (
  341. <div class='operation-btns'>
  342. <el-button type="text" onClick={() => {
  343. this.formType = 0
  344. this.getDetail(row.id)
  345. }}>查看</el-button>
  346. {["PAID", "REFUND"].includes(row.payStatus) ? (
  347. <el-button type="text" onClick={() => {
  348. this.$router.push({
  349. name: "workOrderPool",
  350. query: {
  351. pgIncreItemId: row.id,
  352. }
  353. })
  354. }}>服务单明细</el-button>
  355. ) : null}
  356. {["PAID"].includes(row.payStatus) && ["ING"].includes(row.settleStatus) ? (
  357. <el-popconfirm
  358. title={`是否确定退款?`}
  359. onConfirm={() => {
  360. increOrderSettleRefund({ id: row.id }).then(res => {
  361. this.$message({ type: 'success', message: `退款成功!` })
  362. this.$refs.pageRef.refreshList()
  363. })
  364. }}
  365. >
  366. <el-button type="text" slot="reference">退款</el-button>
  367. </el-popconfirm>
  368. ) : null}
  369. {["PAID"].includes(row.payStatus) && ["ING"].includes(row.settleStatus) ? (
  370. <el-button type="text" onClick={() => {
  371. this.formType = 1
  372. this.getDetail(row.id)
  373. }}>结算</el-button>
  374. ) : null}
  375. </div>
  376. )
  377. },
  378. getDetail(id) {
  379. increOrderSettleDetail({ id }).then(res => {
  380. Object.assign(this.formData, res.data)
  381. this.openForm()
  382. })
  383. },
  384. openForm() {
  385. this.formDialog = true
  386. },
  387. // 关闭弹窗
  388. formCancel() {
  389. this.$refs.formRef.$refs.inlineForm.clearValidate()
  390. this.$data.formData = this.$options.data().formData
  391. this.formDialog = false
  392. },
  393. formConfirm() {
  394. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  395. if (valid) {
  396. increOrderSettleConfirm([this.formData.id]).then(res => {
  397. this.$message({ type: 'success', message: `操作成功!` })
  398. this.formCancel()
  399. this.$refs.pageRef.refreshList()
  400. })
  401. }
  402. })
  403. },
  404. }
  405. }
  406. </script>
  407. <style lang="scss">
  408. .redbordererr {
  409. .el-form-item {
  410. margin: 0 !important;
  411. overflow: hidden;
  412. }
  413. }
  414. </style>