index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title+'-列表', essential: true }]">
  3. <template slot-scope="{activeKey, data}">
  4. <template-page ref="pageRef" v-if="tabIndexShow && activeKey == 'list'" :get-list="getList" :table-attributes="tableAttributes"
  5. :table-events="tableEvents" :operationColumnWidth="120" :options-evens-group="optionsEvensGroup"
  6. :moreParameters="moreParameters" :column-parsing="columnParsing" :operation="operation()"
  7. :exportList="tabIndex == 1 ? exportList1 : exportList2">
  8. <div slot="moreSearch" style="margin-bottom: 10px;">
  9. <el-radio-group v-model="tabIndex" size="mini" @change="changeType">
  10. <el-radio-button label="1">汇总</el-radio-button>
  11. <el-radio-button label="2">明细</el-radio-button>
  12. </el-radio-group>
  13. </div>
  14. <div slot="moreSearch" v-if="tabIndex == 2">
  15. <el-radio-group v-model="status" size="mini" @change="changeType">
  16. <el-radio-button label="">全部</el-radio-button>
  17. <el-radio-button label="WAIT">待结算</el-radio-button>
  18. <el-radio-button label="WAIT_ING">可提现</el-radio-button>
  19. <el-radio-button label="ING">提现中</el-radio-button>
  20. <el-radio-button label="OVER">已提现</el-radio-button>
  21. </el-radio-group>
  22. <br><br>
  23. </div>
  24. </template-page>
  25. <div v-if="~['detail'].indexOf(activeKey)">
  26. <el-card class="box-card">
  27. <div slot="header" class="clearfix">
  28. <span>基础信息</span>
  29. </div>
  30. <table border="1" style="border-color: #fff;" width="100%" align="center" cellspacing="0" cellpadding="10">
  31. <tr>
  32. <td class="bold" align="center">所属商户</td>
  33. <td>{{ formData.companyWechatName }}</td>
  34. <td class="bold" align="center">关联工单号</td>
  35. <td>{{ formData.workerOrderId }}</td>
  36. <td class="bold" align="center">结算单号</td>
  37. <td>{{ formData.settlementOrderId }}</td>
  38. <td class="bold" align="center">工单品牌</td>
  39. <td>{{ formData.brand }}</td>
  40. </tr>
  41. <tr>
  42. <td class="bold" align="center">客户姓名</td>
  43. <td>{{ formData.userName }}</td>
  44. <td class="bold" align="center">客户电话</td>
  45. <td>{{ formData.userMobile }}</td>
  46. <td class="bold" align="center">师傅姓名</td>
  47. <td>{{ formData.workerName }}</td>
  48. <td class="bold" align="center">师傅身份证号</td>
  49. <td>{{ formData.identity }}</td>
  50. </tr>
  51. <tr>
  52. <td class="bold" align="center">师傅联系电话</td>
  53. <td>{{ formData.workerMobile }}</td>
  54. <td class="bold" align="center">订单金额</td>
  55. <td>{{ formData.totalAmount }}</td>
  56. <td class="bold" align="center">销售类型</td>
  57. <td>{{ formData.settlementType == 'OWN' ? '自由' : formData.settlementType == 'OUT' ? '外购' : '' }}</td>
  58. <td class="bold" align="center">创建人</td>
  59. <td>{{ formData.createBy }}</td>
  60. </tr>
  61. <tr>
  62. <td class="bold" align="center">创建时间</td>
  63. <td>{{ formData.createTime }}</td>
  64. <td class="bold" align="center">支付状态</td>
  65. <td>{{ formData.payStatus == 'CANCEL' ? '取消' : formData.payStatus == 'PAID' ? '已支付' : formData.payStatus ==
  66. 'WAIT' ? '待支付' : '' }}</td>
  67. <td class="bold" align="center">支付订单号</td>
  68. <td>{{ formData.orderId }}</td>
  69. <td class="bold" align="center">支付时间</td>
  70. <td>{{ formData.payTime }}</td>
  71. </tr>
  72. <tr>
  73. <td class="bold" align="center">分账单号</td>
  74. <td>{{ formData.settlementOrderId }}</td>
  75. <td class="bold" align="center">分账状态</td>
  76. <td>{{ formData.status == 'WAIT' ? '待结算' : formData.status == 'WAIT_ING' ? '可提现' : formData.status ==
  77. 'ING' ? '提现中' : formData.status == 'OVER' ? '已提现' : '' }}</td>
  78. <td class="bold" align="center">分账金额</td>
  79. <td>{{ formData.amount }}</td>
  80. <td class="bold" align="center">分账时间</td>
  81. <td>{{ formData.settlementTime }}</td>
  82. </tr>
  83. <tr>
  84. <td class="bold" align="center">师傅分账金额</td>
  85. <td>{{ formData.workerAmount }}</td>
  86. <td class="bold" align="center">师傅分账金额手续费</td>
  87. <td>{{ formData.workerProceAmount }}</td>
  88. <td class="bold" align="center">商户分账金额</td>
  89. <td>{{ formData.websitAmount }}</td>
  90. <td class="bold" align="center">商户分账金额手续费</td>
  91. <td>{{ formData.websitProceAmount }}</td>
  92. </tr>
  93. <tr>
  94. <td class="bold" align="center">操作人</td>
  95. <td>{{ formData.updateBy }}</td>
  96. <td class="bold" align="center">操作时间</td>
  97. <td>{{ formData.updateTime }}</td>
  98. <td></td>
  99. <td></td>
  100. <td></td>
  101. <td></td>
  102. </tr>
  103. </table>
  104. </el-card>
  105. <el-card class="box-card">
  106. <div slot="header" class="clearfix">
  107. <span>订单信息</span>
  108. </div>
  109. <table border="1" style="border-color: #fff;" width="100%" align="center" cellspacing="0" cellpadding="10">
  110. <thead>
  111. <tr>
  112. <th class="bold" align="center">名称</th>
  113. <th class="bold" align="center">收费类型</th>
  114. <th class="bold" align="center">数量</th>
  115. <th class="bold" align="center">单价</th>
  116. <th class="bold" align="center">订单金额</th>
  117. <th class="bold" align="center">销售类型</th>
  118. <th class="bold" align="center">手续费</th>
  119. <th class="bold" align="center">师傅分账金额</th>
  120. <th class="bold" align="center">商户分账金额</th>
  121. </tr>
  122. </thead>
  123. <tbody>
  124. <tr v-for="(item, index) in formData.settlementOrderItemList" :key="index">
  125. <td align="center">{{ item.goodsName }}</td>
  126. <td align="center">{{ item.chargeType == 'ACC' ? (item.goodsType ==
  127. 'M' ? '辅材' : '配件') + '物料' : item.chargeType == 'SERV' ? '服务收费' : '' }}</td>
  128. <td align="center">{{ item.num }}</td>
  129. <td align="center">{{ item.goodsAmount }}</td>
  130. <td align="center">{{ item.totalAmount }}</td>
  131. <td align="center">{{ item.settlementType == 'OWN' ? '自有' : item.settlementType == 'OUT' ? '外购' : '' }}</td>
  132. <td align="center">{{ (item.websitProceAmount * 100 + item.workerProceAmount * 100) / 100 }}</td>
  133. <td align="center">{{ item.workerAmount }}</td>
  134. <td align="center">{{ item.websitAmount }}</td>
  135. </tr>
  136. <!-- <tr>
  137. <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
  138. </tr> -->
  139. <tr>
  140. <td align="center">总计</td>
  141. <td></td>
  142. <td></td>
  143. <td></td>
  144. <td align="center">{{ totalAmount }}</td>
  145. <td></td>
  146. <td align="center">{{ commissionAmount }}</td>
  147. <td align="center">{{ workerAmount }}</td>
  148. <td align="center">{{ websitAmount }}</td>
  149. </tr>
  150. </tbody>
  151. </table>
  152. </el-card>
  153. <div slot="footer" class="dialog-footer">
  154. <el-button size="mini" @click="formDialog = false; formData = {};data.removeTab()">取 消</el-button>
  155. <el-button size="mini" v-if="formData.status == 'WAIT'" type="primary"
  156. @click="settleAccounts(formData.settlementOrderId,data.removeTab)">确认结算
  157. </el-button>
  158. <el-button size="mini" v-if="formData.status == 'WAIT_ING'" type="primary" @click="withdraw(formData.settlementOrderId,data.removeTab)">
  159. 确认提现
  160. </el-button>
  161. </div>
  162. </div>
  163. </template>
  164. </zj-tab-page>
  165. </template>
  166. <script>
  167. import TemplatePage from '@/components/template/template-page-1.vue'
  168. import import_mixin from '@/components/template/import_mixin.js'
  169. import operation_mixin from '@/components/template/operation_mixin.js'
  170. import ImageUpload from '@/components/file-upload'
  171. import { downloadFiles } from '@/utils/util'
  172. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  173. import { listPageV1, listPageV2, pageExport1, pageExport2, getDetail, refund, settleAccounts, withdraw } from "@/api/auxiliaryFittings/settleAccountWeixinPay";
  174. export default {
  175. components: { TemplatePage, ImageUpload },
  176. mixins: [import_mixin, operation_mixin],
  177. data() {
  178. return {
  179. // 表格属性
  180. tableAttributes: {
  181. // 启用勾选列
  182. selectColumn: true
  183. },
  184. // 表格事件
  185. tableEvents: {
  186. 'selection-change': this.selectionChange
  187. },
  188. // 勾选选中行
  189. recordSelected: [],
  190. formDialogType: 0,
  191. formDialogTitles: ["新增", "编辑", "详情"],
  192. formDialog: false,
  193. formData: {},
  194. status: '',
  195. totalAmount: 0,
  196. workerAmount: 0,
  197. websitAmount: 0,
  198. commissionAmount: 0,
  199. tabIndex: 1,
  200. workerId: '',
  201. websitId: '',
  202. tabIndexShow: true,
  203. formType: 'add',
  204. formVisible: false,
  205. }
  206. },
  207. watch: {
  208. tabIndex() {
  209. this.tabIndexShow = false
  210. this.$nextTick(() => {
  211. if(this.tabIndex == 1){
  212. this.status = ''
  213. }
  214. this.tabIndexShow = true
  215. })
  216. }
  217. },
  218. computed: {
  219. // 事件组合
  220. optionsEvensGroup() {
  221. return [
  222. [
  223. [
  224. this.optionsEvensAuth("bulkSettlement", {
  225. isRole: this.tabIndex == 2,
  226. click: () => {
  227. this.batchSettleAccounts()
  228. }
  229. })
  230. ],
  231. ],
  232. [
  233. [
  234. this.optionsEvensAuth("bulkWithdrawal", {
  235. isRole: this.tabIndex == 2,
  236. click: () => {
  237. this.batchWithdraw()
  238. }
  239. })
  240. ],
  241. ]
  242. ]
  243. },
  244. // 更多参数
  245. moreParameters() {
  246. return []
  247. }
  248. },
  249. methods: {
  250. // 切换状态
  251. changeType(val) {
  252. this.workerId = ''
  253. this.websitId = ''
  254. this.$refs.pageRef.refreshList()
  255. },
  256. // 列表请求函数
  257. getList(p) {
  258. try {
  259. var pam = JSON.parse(JSON.stringify(p))
  260. pam.params.push({ "param": "a.pay_type", "compare": "=", "value": 'WECHAT' })
  261. if (this.status && this.tabIndex == 2) {
  262. pam.params.push({ "param": "a.status", "compare": "=", "value": this.status })
  263. }
  264. if (this.workerId) {
  265. pam.params.push({ "param": "a.websit_id", "compare": "=", "value": this.websitId }, { "param": "a.worker_id", "compare": "=", "value": this.workerId })
  266. }
  267. return this.tabIndex == 1 ? listPageV1(pam) : listPageV2(pam)
  268. } catch (error) {
  269. console.log(error)
  270. }
  271. },
  272. // 列表导出函数
  273. exportList1: pageExport1,
  274. exportList2: pageExport2,
  275. // 表格列解析渲染数据更改
  276. columnParsing(item, defaultData) {
  277. return defaultData
  278. },
  279. // 监听勾选变化
  280. selectionChange(data) {
  281. this.recordSelected = data
  282. },
  283. openForm(type, id) {
  284. this.$refs.tabPage.addTab({
  285. // 对应显示的模块
  286. activeKey: type,
  287. // 唯一标识
  288. key: type,
  289. // 页签名称
  290. label: ({ detail: "详情" })[type],
  291. // 打开时事件
  292. triggerEvent: () => {
  293. this.formCancel()
  294. this.$nextTick(()=>{
  295. this.formType = type
  296. this.formVisible = true
  297. if (type == 'detail') {
  298. this.formDialogType = 1
  299. this.totalAmount = 0
  300. this.workerAmount = 0
  301. this.websitAmount = 0
  302. this.commissionAmount = 0
  303. getDetail({ id }).then(res => {
  304. Object.assign(this.formData, res.data)
  305. res.data.settlementOrderItemList.forEach(item => {
  306. this.totalAmount += (item.totalAmount * 100 + this.totalAmount * 100) / 100
  307. this.workerAmount = (item.workerAmount * 100 + this.workerAmount * 100) / 100
  308. this.websitAmount += (item.websitAmount * 100 + this.websitAmount * 100) / 100
  309. this.commissionAmount += (item.websitProceAmount * 100 + item.workerProceAmount * 100 + this.commissionAmount * 100) / 100
  310. })
  311. })
  312. }
  313. })
  314. },
  315. // 关闭时事件
  316. closeEvent: () => {
  317. }
  318. })
  319. },
  320. formCancel() {
  321. this.formVisible = false
  322. this.$refs?.formRef?.resetFields()
  323. this.$data.formRef = this.$options.data().formRef
  324. },
  325. // 表格操作列
  326. operation() {
  327. return this.operationBtn({
  328. detail: {
  329. btnType: 'text',
  330. name: ({ row, index, column }) => {
  331. return this.tabIndex == 1 ? '查看明细' : '详情'
  332. },
  333. click: ({ row, index, column }) => {
  334. if (this.tabIndex == 1) {
  335. this.workerId = row.workerId
  336. this.websitId = row.websitId
  337. this.tabIndex = 2
  338. this.$refs.pageRef.refreshList()
  339. } else {
  340. this.openForm('detail',row.settlementOrderId)
  341. }
  342. }
  343. },
  344. refund: {
  345. btnType: 'text',
  346. prompt: '确认是否退款?',
  347. conditions: ({ row, index, column }) => {
  348. return row.totalAmount > 0 && this.tabIndex == 2
  349. },
  350. click: ({ row, index, column }) => {
  351. refund({ id: row.settlementOrderId }).then(res => {
  352. if (res.code == 200) {
  353. this.$message({ type: 'success', message: '退款成功!' })
  354. this.$refs.pageRef.refreshList()
  355. } else {
  356. this.$message.error(res.msg);
  357. }
  358. })
  359. }
  360. },
  361. settlement: {
  362. btnType: 'text',
  363. conditions: ({ row, index, column }) => {
  364. return row.status == 'WAIT' || this.tabIndex == 1
  365. },
  366. click: ({ row, index, column }) => {
  367. if (this.tabIndex == 1) {
  368. this.status = 'WAIT'
  369. this.workerId = row.workerId
  370. this.websitId = row.websitId
  371. this.tabIndex = 2
  372. this.$refs.pageRef.refreshList()
  373. } else {
  374. this.settleAccounts(row.settlementOrderId)
  375. }
  376. }
  377. },
  378. withdraw: {
  379. btnType: 'text',
  380. conditions: ({ row, index, column }) => {
  381. return row.status == 'WAIT_ING' && this.tabIndex == 2
  382. },
  383. click: ({ row, index, column }) => {
  384. this.withdraw(row.settlementOrderId)
  385. }
  386. },
  387. })
  388. },
  389. batchSettleAccounts() {
  390. if (this.recordSelected.length == 0) {
  391. return this.$message.warning('请至少勾选一条数据!');
  392. }
  393. this.settleAccounts(this.recordSelected.map(item => { return item.settlementOrderId }).join(','))
  394. },
  395. settleAccounts(id,cancel) {
  396. this.$confirm(`请确认是否结算选中数据, 是否继续?`, '提示', {
  397. confirmButtonText: '确定',
  398. cancelButtonText: '取消',
  399. type: 'warning'
  400. }).then(() => {
  401. settleAccounts({
  402. id
  403. }).then(res => {
  404. if (res.code == 200) {
  405. this.$message({ type: 'success', message: `结算成功!` })
  406. cancel('list')
  407. this.$refs.pageRef.refreshList()
  408. this.formDialog = false
  409. } else {
  410. this.$message.error(res.msg);
  411. }
  412. })
  413. });
  414. },
  415. batchWithdraw() {
  416. if (this.recordSelected.length == 0) {
  417. return this.$message.warning('请至少勾选一条数据!');
  418. }
  419. this.withdraw(this.recordSelected.map(item => { return item.settlementOrderId }).join(','))
  420. },
  421. withdraw(id,cancel) {
  422. this.$confirm(`请确认是否提现选中数据, 是否继续?`, '提示', {
  423. confirmButtonText: '确定',
  424. cancelButtonText: '取消',
  425. type: 'warning'
  426. }).then(() => {
  427. withdraw({
  428. id
  429. }).then(res => {
  430. if (res.code == 200) {
  431. this.$message({ type: 'success', message: `提现成功!` })
  432. cancel('list')
  433. this.$refs.pageRef.refreshList()
  434. this.formDialog = false
  435. } else {
  436. this.$message.error(res.msg);
  437. }
  438. })
  439. });
  440. },
  441. }
  442. }
  443. </script>
  444. <style lang="scss" scoped>
  445. .tab {
  446. padding: 20px 20px 0 20px;
  447. }
  448. .bold {
  449. width: 160px;
  450. font-weight: bold;
  451. background-color: #f0f0f0;
  452. }</style>