index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="200"
  3. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
  4. :operation="operation()">
  5. <!-- :exportList="exportList" -->
  6. <div slot="moreSearch">
  7. <el-radio-group v-model="examineStatus" size="mini" @change="changeType">
  8. <el-radio-button label="">全部</el-radio-button>
  9. <el-radio-button label="WAIT">待审核</el-radio-button>
  10. <el-radio-button label="OK">审核通过</el-radio-button>
  11. <el-radio-button label="FAIL">驳回</el-radio-button>
  12. </el-radio-group>
  13. <br><br>
  14. </div>
  15. <el-dialog title="" width="800px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
  16. :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
  17. <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
  18. <zj-form-module :title="formDialogTitles[formDialogType]" label-width="100px" :showPackUp="false"
  19. :form-data="formData" :form-items="formItems">
  20. </zj-form-module>
  21. </zj-form-container>
  22. <div slot="footer" class="dialog-footer">
  23. <el-button v-if="formData.examineStatus == 'WAIT'" size="mini" type="primary" @click="audit('OK')">审核通过</el-button>
  24. <el-button v-if="formData.examineStatus == 'WAIT'" size="mini" type="danger" @click="audit('FAIL')">审核驳回</el-button>
  25. <el-button size="mini" @click="formCancel">取 消</el-button>
  26. </div>
  27. </el-dialog>
  28. </template-page>
  29. </template>
  30. <script>
  31. import TemplatePage from '@/components/template/template-page-1.vue'
  32. import import_mixin from '@/components/template/import_mixin.js'
  33. import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
  34. import { memberListPageV2,memberPageExport, getMemberDetail, memberAudit, memberInner } from "@/api/masterManagement";
  35. import operation_mixin from '@/components/template/operation_mixin.js'
  36. export default {
  37. components: { TemplatePage },
  38. mixins: [import_mixin,operation_mixin],
  39. data() {
  40. return {
  41. // 事件组合
  42. optionsEvensGroup: [],
  43. // 表格属性
  44. tableAttributes: {
  45. // 启用勾选列
  46. selectColumn: false
  47. },
  48. // 表格事件
  49. tableEvents: {
  50. 'selection-change': this.selectionChange
  51. },
  52. // 勾选选中行
  53. recordSelected: [],
  54. /** 表单变量 */
  55. formDialogType: 0,
  56. formDialogTitles: ["审核", "详情"],
  57. formDialog: false,
  58. formData: {
  59. type: '工程师',
  60. examineRemark: ''
  61. },
  62. examineStatus: ''
  63. }
  64. },
  65. computed: {
  66. // 更多参数
  67. moreParameters() {
  68. return []
  69. },
  70. formItems() {
  71. return [{
  72. md: 12,
  73. isShow: true,
  74. name: 'el-select',
  75. options: [{label: '待审核', value: 'WAIT'},{label: '驳回', value: 'FAIL'},{label: '通过', value: 'OK'}],
  76. attributes: { placeholder: '请输入', disabled: true },
  77. formItemAttributes: {
  78. label: '审核状态',
  79. prop: 'examineStatus',
  80. rules: []
  81. },
  82. }, {
  83. md: 12,
  84. isShow: true,
  85. name: 'el-input',
  86. attributes: { disabled: true },
  87. formItemAttributes: {
  88. label: '用户类型',
  89. prop: 'type',
  90. rules: []
  91. }
  92. }, {
  93. md: 12,
  94. isShow: true,
  95. name: 'el-input',
  96. attributes: { placeholder: '请输入', disabled: true },
  97. formItemAttributes: {
  98. label: '用户名称',
  99. prop: 'nickName',
  100. rules: []
  101. }
  102. }, {
  103. md: 12,
  104. isShow: true,
  105. name: 'el-input',
  106. attributes: { placeholder: '请输入', disabled: true },
  107. formItemAttributes: {
  108. label: '联系电话',
  109. prop: 'mobile',
  110. rules: []
  111. }
  112. }, {
  113. md: 12,
  114. isShow: true,
  115. name: 'el-input',
  116. attributes: { placeholder: '请输入', disabled: true },
  117. formItemAttributes: {
  118. label: '身份证号码',
  119. prop: 'idCard',
  120. rules: []
  121. }
  122. }, {
  123. md: 12,
  124. isShow: true,
  125. name: 'slot-component',
  126. attributes: { },
  127. formItemAttributes: {
  128. label: '身份证',
  129. prop: 'idCardImg',
  130. rules: []
  131. },
  132. render: (h, { props, onInput }) => {
  133. var { value } = props
  134. return (
  135. <el-image src={this.formData.idCardImg} style='width: 120px;height:120px' preview-src-list={[this.formData.idCardImg]} fit="fit"></el-image>
  136. )
  137. }
  138. }, {
  139. md: 12,
  140. isShow: true,
  141. name: 'el-input',
  142. attributes: { placeholder: '请输入', disabled: true },
  143. formItemAttributes: {
  144. label: '所属商户',
  145. prop: 'companyName',
  146. rules: []
  147. }
  148. }, {
  149. md: 12,
  150. isShow: true,
  151. name: 'el-input',
  152. attributes: { placeholder: '请输入', disabled: true },
  153. formItemAttributes: {
  154. label: '入驻网点',
  155. prop: 'websitName',
  156. rules: []
  157. }
  158. }, {
  159. md: 24,
  160. isShow: true,
  161. name: 'el-input',
  162. attributes: { placeholder: '请输入',type: "textarea", disabled: this.formData.examineStatus == 'WAIT' ? false:true },
  163. formItemAttributes: {
  164. label: '备注',
  165. prop: 'examineRemark',
  166. rules: []
  167. }
  168. }]
  169. }
  170. },
  171. methods: {
  172. // 切换状态
  173. changeType(val) {
  174. this.$refs.pageRef.refreshList()
  175. },
  176. // 列表请求函数
  177. getList(p) {
  178. try {
  179. var pam = JSON.parse(JSON.stringify(p))
  180. if (this.examineStatus) {
  181. pam.params.push({ "param": "b.examine_status", "compare": "=", "value": this.examineStatus })
  182. }
  183. return memberListPageV2(pam)
  184. } catch (error) {
  185. console.log(error)
  186. }
  187. },
  188. // 列表导出函数
  189. exportList: memberPageExport,
  190. // 表格列解析渲染数据更改
  191. columnParsing(item, defaultData) {
  192. if (item.jname === 'idCardImg') {
  193.         defaultData.render = (h, { row, index, column }) => {
  194.           return (
  195.             <div style="padding:0 6px;cursor: pointer;">
  196.               {row.idCardImg ? row.idCardImg.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
  197.             </div>
  198.           )
  199.         }
  200.       }
  201. return defaultData
  202. },
  203. // 监听勾选变化
  204. selectionChange(data) {
  205. this.recordSelected = data
  206. },
  207. // 表格操作列
  208. operation() {
  209. return this.operationBtn({
  210. detail: {
  211. btnType: 'text',
  212. click: ({ row, index, column }) => {
  213. getMemberDetail({ id: row.id }).then(res => {
  214. Object.assign(this.formData, res.data)
  215. this.formDialogType = 1
  216. this.openForm()
  217. })
  218. }
  219. },
  220. examine: {
  221. btnType: 'text',
  222. conditions: ({ row, index, column }) => {
  223. return row.examineStatus == 'WAIT'
  224. },
  225. click: ({ row, index, column }) => {
  226. getMemberDetail({ id: row.id }).then(res => {
  227. Object.assign(this.formData, res.data)
  228. this.formDialogType = 0
  229. this.openForm()
  230. })
  231. }
  232. },
  233. setService: {
  234. btnType: 'text',
  235. prompt: '请确认是否设为分销员?',
  236. click: ({ row, index, column }) => {
  237. memberInner({
  238. type: 'SERVICE',
  239. userIds: row.userId
  240. }).then(res => {
  241. if (res.code == 200) {
  242. this.$message({ type: 'success', message: '设为分销员成功!' })
  243. this.$refs.pageRef.refreshList()
  244. } else {
  245. this.$message.error(res.msg);
  246. }
  247. })
  248. }
  249. },
  250. setCustomer: {
  251. btnType: 'text',
  252. prompt: '请确认是否设为客户?',
  253. click: ({ row, index, column }) => {
  254. memberInner({
  255. type: 'GENERAL',
  256. userIds: row.userId
  257. }).then(res => {
  258. if (res.code == 200) {
  259. this.$message({ type: 'success', message: '设为客户成功!' })
  260. this.$refs.pageRef.refreshList()
  261. } else {
  262. this.$message.error(res.msg);
  263. }
  264. })
  265. }
  266. },
  267. })
  268. },
  269. addData() {
  270. this.formDialogType = 0
  271. this.openForm()
  272. },
  273. openForm() {
  274. this.formDialog = true;
  275. },
  276. formCancel() {
  277. this.$refs.formRef.$refs.inlineForm.clearValidate()
  278. this.$data.formData = this.$options.data().formData
  279. this.formDialog = false
  280. },
  281. audit(examineStatusEnum){
  282. memberAudit({
  283. examineStatusEnum,
  284. examineRemark: this.formData.examineRemark,
  285. id: this.formData.id
  286. }).then(res => {
  287. this.$message({ type: 'success', message: '审核成功!' })
  288. this.formCancel()
  289. this.$refs.pageRef.refreshList()
  290. })
  291. },
  292. memberInner(type){
  293. memberInner({
  294. type,
  295. userIds: this.formData.userId
  296. }).then(res => {
  297. this.$message({ type: 'success', message: '设置成功!' })
  298. this.$refs.pageRef.refreshList()
  299. })
  300. },
  301. formConfirm() {
  302. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  303. if (valid) {
  304. ([memberAudit][this.formDialogType])(this.formData).then(res => {
  305. this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
  306. this.formCancel()
  307. this.$refs.pageRef.refreshList()
  308. })
  309. }
  310. })
  311. }
  312. }
  313. }
  314. </script>
  315. <style lang="scss" scoped>
  316. .tab{
  317. padding: 20px 20px 0 20px;
  318. }
  319. </style>