index.vue 10 KB

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