index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="120"
  3. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
  4. :operation="operation" :exportList="exportList">
  5. <div slot="moreSearch">
  6. <el-radio-group v-model="status" size="mini" @change="changeType">
  7. <el-radio-button label="">全部</el-radio-button>
  8. <el-radio-button label="WAIT">待结算</el-radio-button>
  9. <el-radio-button label="WAIT_ING">可提现</el-radio-button>
  10. <el-radio-button label="ING">提现中</el-radio-button>
  11. <el-radio-button label="OVER">已提现</el-radio-button>
  12. </el-radio-group>
  13. <br><br>
  14. </div>
  15. <el-dialog title="详情" width="80%" :modal="true" :visible.sync="formDialog" :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" @close="formDialog = false;formData = {}">
  16. <el-card class="box-card">
  17. <div slot="header" class="clearfix">
  18. <span>基础信息</span>
  19. </div>
  20. <table border="1" style="border-color: #fff;" width="100%" align="center" cellspacing="0" cellpadding="10">
  21. <tr>
  22. <td class="bold" align="center">所属商户</td>
  23. <td>{{formData.companyWechatName}}</td>
  24. <td class="bold" align="center">网点名称</td>
  25. <td>{{formData.websitName}}</td>
  26. </tr>
  27. <tr>
  28. <td class="bold" align="center">结算单号</td>
  29. <td>{{formData.settlementOrderId}}</td>
  30. <td class="bold" align="center">工单品牌</td>
  31. <td>{{formData.brand}}</td>
  32. </tr>
  33. <tr>
  34. <td class="bold" align="center">客户姓名</td>
  35. <td>{{formData.userName}}</td>
  36. <td class="bold" align="center">客户电话</td>
  37. <td>{{formData.userMobile}}</td>
  38. </tr>
  39. <tr>
  40. <td class="bold" align="center">师傅姓名</td>
  41. <td>{{formData.workerName}}</td>
  42. <td class="bold" align="center">师傅身份证号</td>
  43. <td>{{formData.identity}}</td>
  44. </tr>
  45. <tr>
  46. <td class="bold" align="center">师傅联系电话</td>
  47. <td>{{formData.workerMobile}}</td>
  48. <td class="bold" align="center">订单金额</td>
  49. <td>{{formData.totalAmount}}</td>
  50. </tr>
  51. <tr>
  52. <td class="bold" align="center">销售类型</td>
  53. <td>{{formData.settlementType == 'OWN'?'自由':formData.settlementType == 'OUT'?'外购':''}}</td>
  54. <td class="bold" align="center">创建人</td>
  55. <td>{{formData.createBy}}</td>
  56. </tr>
  57. <tr>
  58. <td class="bold" align="center">创建时间</td>
  59. <td>{{formData.createTime}}</td>
  60. <td class="bold" align="center">支付状态</td>
  61. <td>{{formData.payStatus == 'CANCEL'?'取消':formData.payStatus == 'PAID'?'已支付':formData.payStatus == 'WAIT'?'待支付':''}}</td>
  62. </tr>
  63. <tr>
  64. <td class="bold" align="center">支付订单号</td>
  65. <td>{{formData.orderId}}</td>
  66. <td class="bold" align="center">支付时间</td>
  67. <td>{{formData.payTime}}</td>
  68. </tr>
  69. <tr>
  70. <td class="bold" align="center">分账单号</td>
  71. <td>{{formData.settlementOrderId}}</td>
  72. <td class="bold" align="center">分账状态</td>
  73. <td>{{formData.status == 'WAIT'?'待结算':formData.status == 'WAIT_ING'?'可提现':formData.status == 'ING'?'提现中':formData.status == 'OVER'?'已提现':''}}</td>
  74. </tr>
  75. <tr>
  76. <td class="bold" align="center">分账金额</td>
  77. <td>{{formData.amount}}</td>
  78. <td class="bold" align="center">分账时间</td>
  79. <td>{{formData.settlementTime}}</td>
  80. </tr>
  81. <tr>
  82. <td class="bold" align="center">师傅分账金额</td>
  83. <td>{{formData.workerAmount}}</td>
  84. <td class="bold" align="center">网点分账金额</td>
  85. <td>{{formData.websitAmount}}</td>
  86. </tr>
  87. <tr>
  88. <td class="bold" align="center">操作人</td>
  89. <td>{{formData.updateBy}}</td>
  90. <td class="bold" align="center">操作时间</td>
  91. <td>{{formData.updateTime}}</td>
  92. </tr>
  93. </table>
  94. </el-card>
  95. <el-card class="box-card">
  96. <div slot="header" class="clearfix">
  97. <span>订单信息</span>
  98. </div>
  99. <table border="1" style="border-color: #fff;" width="100%" align="center" cellspacing="0" cellpadding="10">
  100. <thead>
  101. <tr>
  102. <th class="bold" align="center">名称</th>
  103. <th class="bold" align="center">收费类型</th>
  104. <th class="bold" align="center">数量</th>
  105. <th class="bold" align="center">单价</th>
  106. <th class="bold" align="center">订单金额</th>
  107. <th class="bold" align="center">销售类型</th>
  108. <th class="bold" align="center">师傅分账金额</th>
  109. <th class="bold" align="center">网点分账金额</th>
  110. </tr>
  111. </thead>
  112. <tbody>
  113. <tr v-for="(item,index) in formData.settlementOrderItemList" :key="index">
  114. <td align="center">{{item.goodsName}}</td>
  115. <td align="center">{{item.chargeType=='ACC'?'配件物料':item.chargeType=='SERV'?'服务收费':''}}</td>
  116. <td align="center">{{item.num}}</td>
  117. <td align="center">{{item.goodsAmount}}</td>
  118. <td align="center">{{item.totalAmount}}</td>
  119. <td align="center">{{item.settlementType == 'OWN'?'自由':item.settlementType == 'OUT'?'外购':''}}</td>
  120. <td align="center">{{item.workerAmount}}</td>
  121. <td align="center">{{item.websitAmount}}</td>
  122. </tr>
  123. <tr>
  124. <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
  125. </tr>
  126. <tr>
  127. <td align="center">总计</td><td></td><td></td><td></td>
  128. <td align="center">{{totalAmount}}</td><td></td>
  129. <td align="center">{{workerAmount}}</td>
  130. <td align="center">{{websitAmount}}</td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. </el-card>
  135. <div slot="footer" class="dialog-footer">
  136. <el-button size="mini" @click="formDialog = false;formData = {}">取 消</el-button>
  137. <el-button size="mini" v-if="formData.status == 'WAIT'" type="primary" @click="settleAccounts(formData.settlementOrderId)">确认结算</el-button>
  138. <el-button size="mini" v-if="formData.status == 'WAIT_ING'" type="primary" @click="withdraw(formData.settlementOrderId)">确认提现</el-button>
  139. </div>
  140. </el-dialog>
  141. </template-page>
  142. </template>
  143. <script>
  144. import TemplatePage from '@/components/template/template-page-1.vue'
  145. import import_mixin from '@/components/template/import_mixin.js'
  146. import ImageUpload from '@/components/file-upload'
  147. import { downloadFiles } from '@/utils/util'
  148. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  149. import { listPageV2,pageExport, getDetail, refund, settleAccounts, withdraw } from "@/api/auxiliaryFittings/settleAccount";
  150. export default {
  151. components: { TemplatePage, ImageUpload },
  152. mixins: [import_mixin],
  153. data() {
  154. return {
  155. // 事件组合
  156. optionsEvensGroup: [
  157. [
  158. [
  159. {
  160. name: '批量结算',
  161. click: ()=>{
  162. this.batchSettleAccounts()
  163. }
  164. }
  165. ]
  166. ],
  167. [
  168. [
  169. {
  170. name: '批量提现',
  171. click: ()=>{
  172. this.batchWithdraw()
  173. }
  174. }
  175. ]
  176. ],
  177. ],
  178. // 表格属性
  179. tableAttributes: {
  180. // 启用勾选列
  181. selectColumn: true
  182. },
  183. // 表格事件
  184. tableEvents: {
  185. 'selection-change': this.selectionChange
  186. },
  187. // 勾选选中行
  188. recordSelected: [],
  189. formDialogType: 0,
  190. formDialogTitles: ["新增","编辑", "详情"],
  191. formDialog: false,
  192. formData: {},
  193. status: '',
  194. totalAmount: 0,
  195. workerAmount: 0,
  196. websitAmount: 0,
  197. }
  198. },
  199. computed: {
  200. // 更多参数
  201. moreParameters() {
  202. return []
  203. }
  204. },
  205. methods: {
  206. // 切换状态
  207. changeType(val) {
  208. this.$refs.pageRef.refreshList()
  209. },
  210. // 列表请求函数
  211. getList(p) {
  212. try {
  213. var pam = JSON.parse(JSON.stringify(p))
  214. if (this.status) {
  215. pam.params.push({ "param": "a.status", "compare": "=", "value": this.status })
  216. }
  217. return listPageV2(pam)
  218. } catch (error) {
  219. console.log(error)
  220. }
  221. },
  222. // 列表导出函数
  223. exportList: pageExport,
  224. // 表格列解析渲染数据更改
  225. columnParsing(item, defaultData) {
  226. return defaultData
  227. },
  228. // 监听勾选变化
  229. selectionChange(data) {
  230. this.recordSelected = data
  231. },
  232. openForm() {
  233. this.formDialog = true;
  234. },
  235. formCancel() {
  236. this.$refs.formRef.$refs.inlineForm.clearValidate()
  237. this.$data.formData = this.$options.data().formData
  238. this.formDialog = false
  239. },
  240. // 表格操作列
  241. operation(h, { row, index, column }) {
  242. return (
  243. <div class='operation-btns'>
  244. <el-button type="text" onClick={() => {
  245. this.totalAmount = 0
  246. this.workerAmount = 0
  247. this.websitAmount = 0
  248. getDetail({ id: row.settlementOrderId }).then(res => {
  249. Object.assign(this.formData, res.data)
  250. res.data.settlementOrderItemList.forEach(item=>{
  251. this.totalAmount += item.totalAmount
  252. this.workerAmount += item.workerAmount
  253. this.websitAmount += item.websitAmount
  254. })
  255. this.formDialogType = 1
  256. this.openForm()
  257. })
  258. }}>查看</el-button>
  259. {row.totalAmount > 0? <el-button type="text" onClick={() => {
  260. this.$confirm('请确认是否退款, 是否继续?', '提示', {
  261. confirmButtonText: '确定',
  262. cancelButtonText: '取消',
  263. type: 'warning'
  264. }).then(() => {
  265. refund({ id: row.settlementOrderId }).then(res => {
  266. if (res.code == 200) {
  267. this.$message({ type: 'success', message: '退款成功!' })
  268. this.$refs.pageRef.refreshList()
  269. } else {
  270. this.$message.error(res.msg);
  271. }
  272. })
  273. });
  274. }}>退款</el-button>:null}
  275. {row.status == 'WAIT'? <el-button type="text" onClick={() => {
  276. this.settleAccounts(row.settlementOrderId)
  277. }}>结算</el-button>:null}
  278. {row.status == 'WAIT_ING'? <el-button type="text" onClick={() => {
  279. this.withdraw(row.settlementOrderId)
  280. }}>提现</el-button>:null}
  281. </div>
  282. )
  283. },
  284. batchSettleAccounts(){
  285. if(this.recordSelected.length == 0){
  286. return this.$message.warning('请至少勾选一条数据!');
  287. }
  288. this.settleAccounts(this.recordSelected.map(item=>{return item.settlementOrderId}).join(','))
  289. },
  290. settleAccounts(id){
  291. this.$confirm(`请确认是否结算选中数据, 是否继续?`, '提示', {
  292. confirmButtonText: '确定',
  293. cancelButtonText: '取消',
  294. type: 'warning'
  295. }).then(() => {
  296. settleAccounts({
  297. id
  298. }).then(res => {
  299. if (res.code == 200) {
  300. this.$message({ type: 'success', message: `结算成功!` })
  301. this.$refs.pageRef.refreshList()
  302. } else {
  303. this.$message.error(res.msg);
  304. }
  305. })
  306. });
  307. },
  308. batchWithdraw(){
  309. if(this.recordSelected.length == 0){
  310. return this.$message.warning('请至少勾选一条数据!');
  311. }
  312. this.withdraw(this.recordSelected.map(item=>{return item.settlementOrderId}).join(','))
  313. },
  314. withdraw(id){
  315. this.$confirm(`请确认是否提现选中数据, 是否继续?`, '提示', {
  316. confirmButtonText: '确定',
  317. cancelButtonText: '取消',
  318. type: 'warning'
  319. }).then(() => {
  320. withdraw({
  321. id
  322. }).then(res => {
  323. if (res.code == 200) {
  324. this.$message({ type: 'success', message: `提现成功!` })
  325. this.$refs.pageRef.refreshList()
  326. } else {
  327. this.$message.error(res.msg);
  328. }
  329. })
  330. });
  331. },
  332. }
  333. }
  334. </script>
  335. <style lang="scss" scoped>
  336. .tab{
  337. padding: 20px 20px 0 20px;
  338. }
  339. .bold{
  340. width: 160px;
  341. font-weight: bold;
  342. background-color: #f0f0f0;
  343. }
  344. </style>