index.vue 11 KB

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