index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <div class="page">
  3. <template-page v-show="!formDialog" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="120"
  4. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
  5. :operation="operation">
  6. <!-- :exportList="exportList" -->
  7. <div slot="moreSearch">
  8. <el-radio-group v-model="status" size="mini" @change="changeType">
  9. <el-radio-button label="">全部</el-radio-button>
  10. <el-radio-button label="NO">待发放</el-radio-button>
  11. <el-radio-button label="YES">已发放</el-radio-button>
  12. <el-radio-button label="NOT">驳回</el-radio-button>
  13. </el-radio-group>
  14. <br><br>
  15. </div>
  16. </template-page>
  17. <div class="detail" v-if="formDialog">
  18. <detailList :id="id" @back="backList" :title="'汇总账单明细-'+id"></detailList>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import TemplatePage from '@/components/template/template-page-1.vue'
  24. import import_mixin from '@/components/template/import_mixin.js'
  25. import ImageUpload from '@/components/file-upload'
  26. import detailList from './detailList.vue'
  27. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  28. import { listPageV2,pageExport, cancel, confirm } from "@/api/workOrder/summaryBill";
  29. export default {
  30. components: { TemplatePage, ImageUpload, detailList },
  31. mixins: [import_mixin],
  32. data() {
  33. return {
  34. // 事件组合
  35. optionsEvensGroup: [
  36. [
  37. [
  38. {
  39. name: '驳回',
  40. click: this.cancelMore
  41. }
  42. ],
  43. ],
  44. [
  45. [
  46. {
  47. name: '发放',
  48. click: this.confirmMore
  49. }
  50. ]
  51. ]
  52. ],
  53. // 表格属性
  54. tableAttributes: {
  55. // 启用勾选列
  56. selectColumn: true
  57. },
  58. // 表格事件
  59. tableEvents: {
  60. 'selection-change': this.selectionChange
  61. },
  62. // 勾选选中行
  63. recordSelected: [],
  64. /** 表单变量 */
  65. formDialogType: 0,
  66. formDialogTitles: ["汇总"],
  67. formDialog: false,
  68. type: JSON.parse(localStorage.getItem('greemall_user')).type, //type=1商户, type=0网点
  69. formData: {
  70. companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
  71. month: (new Date().getFullYear()) + '-' + ((new Date().getMonth() + 1)>9?(new Date().getMonth() + 1):('0'+(new Date().getMonth() + 1))),
  72. createdTime: [],
  73. starDate: '',
  74. endDate: '',
  75. },
  76. status: '',
  77. id: ''
  78. }
  79. },
  80. computed: {
  81. // 更多参数
  82. moreParameters() {
  83. return []
  84. },
  85. formItems() {
  86. return [{
  87. md: 24,
  88. isShow: true,
  89. name: 'el-input',
  90. attributes: { placeholder: '请输入', disabled: true },
  91. formItemAttributes: {
  92. label: '所属商户',
  93. prop: 'companyName',
  94. rules: [...required]
  95. },
  96. }, {
  97. md: 24,
  98. isShow: true,
  99. name: 'el-input',
  100. attributes: { placeholder: '请输入', disabled: true },
  101. formItemAttributes: {
  102. label: '月份',
  103. prop: 'month',
  104. rules: [...required]
  105. }
  106. }, {
  107. md: 24,
  108. isShow: true,
  109. name: 'slot-component',
  110. attributes: { placeholder: '请选择',},
  111. formItemAttributes: {
  112. label: '创建结算单时间',
  113. prop: 'createdTime',
  114. rules: [...required]
  115. },
  116. render: (h, { props, onInput }) => {
  117. var { value } = props
  118. return (
  119. <el-date-picker
  120. v-model={this.formData.createdTime}
  121. type="daterange"
  122. range-separator="至"
  123. start-placeholder="开始日期"
  124. end-placeholder="结束日期"
  125. onChange={e=>{
  126. this.formData.starDate = e[0]
  127. this.formData.endDate = e[1]
  128. }}>
  129. </el-date-picker>
  130. )
  131. }
  132. }]
  133. }
  134. },
  135. methods: {
  136. // 切换状态
  137. changeType(val) {
  138. this.$refs.pageRef.refreshList()
  139. },
  140. backList() {
  141. this.id = ''
  142. this.formDialog = false;
  143. this.$refs.pageRef.refreshList()
  144. },
  145. // 列表请求函数
  146. getList(p,cb) {
  147. try {
  148. var pam = JSON.parse(JSON.stringify(p))
  149. pam.params.push({'param': 'a.status', "compare": "=", "value": this.status})
  150. cb && cb(pam)
  151. return listPageV2(pam)
  152. } catch (error) {
  153. console.log(error)
  154. }
  155. },
  156. // 列表导出函数
  157. exportList: pageExport,
  158. // 表格列解析渲染数据更改
  159. columnParsing(item, defaultData) {
  160. return defaultData
  161. },
  162. // 监听勾选变化
  163. selectionChange(data) {
  164. this.recordSelected = data
  165. },
  166. // 表格操作列
  167. operation(h, { row, index, column }) {
  168. return (
  169. <div class='operation-btns'>
  170. <el-button type="text" onClick={() => {
  171. this.id = row.id
  172. this.formDialog = true
  173. }}>明细</el-button>
  174. {row.status == 'NO'?<el-button type="text" onClick={() => {
  175. this.confirm(row.id)
  176. }}>发放</el-button>:null}
  177. {row.status == 'NO'?<el-button type="text" onClick={() => {
  178. this.cancel(row.id)
  179. }}>驳回</el-button>:null}
  180. </div>
  181. )
  182. },
  183. cancelMore(){
  184. if(this.recordSelected.length == 0){
  185. return this.$message.warning('请至少勾选一条数据!');
  186. }
  187. this.cancel(this.recordSelected.map(item=>{return item.id}).join(','))
  188. },
  189. cancel(ids) {
  190. this.$confirm('请确认是否驳回选中的数据, 是否继续?', '提示', {
  191. confirmButtonText: '确定',
  192. cancelButtonText: '取消',
  193. type: 'warning'
  194. }).then(() => {
  195. cancel([ids]).then(res => {
  196. this.$message({ type: 'success', message: `驳回成功!` })
  197. this.$refs.pageRef.refreshList()
  198. })
  199. });
  200. },
  201. confirmMore(){
  202. if(this.recordSelected.length == 0){
  203. return this.$message.warning('请至少勾选一条数据!');
  204. }
  205. this.confirm(this.recordSelected.map(item=>{return item.id}).join(','))
  206. },
  207. confirm(ids){
  208. this.$confirm('请确认是否发放选中的数据, 是否继续?', '提示', {
  209. confirmButtonText: '确定',
  210. cancelButtonText: '取消',
  211. type: 'warning'
  212. }).then(() => {
  213. confirm([ids]).then(res => {
  214. this.$message({ type: 'success', message: `发放成功!` })
  215. this.$refs.pageRef.refreshList()
  216. })
  217. });
  218. }
  219. }
  220. }
  221. </script>
  222. <style lang="scss" scoped>
  223. .tab{
  224. padding: 20px 20px 0 20px;
  225. }
  226. .page{
  227. height: 100%;
  228. }
  229. </style>