index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: '列表页面', 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. return (
  143. <el-image src={this.formData.idCardImg} style='width: 120px;height:120px' preview-src-list={[this.formData.idCardImg]} fit="fit"></el-image>
  144. )
  145. }
  146. }, {
  147. md: 12,
  148. isShow: true,
  149. name: 'el-input',
  150. attributes: { placeholder: '请输入', disabled: true },
  151. formItemAttributes: {
  152. label: '所属商户',
  153. prop: 'companyName',
  154. rules: []
  155. }
  156. }, {
  157. md: 12,
  158. isShow: true,
  159. name: 'el-input',
  160. attributes: { placeholder: '请输入', disabled: true },
  161. formItemAttributes: {
  162. label: '入驻网点',
  163. prop: 'websitName',
  164. rules: []
  165. }
  166. }, {
  167. md: 24,
  168. isShow: true,
  169. name: 'el-input',
  170. attributes: { placeholder: '请输入', type: "textarea", disabled: this.formData.examineStatus == 'WAIT' ? false : true },
  171. formItemAttributes: {
  172. label: '备注',
  173. prop: 'examineRemark',
  174. rules: []
  175. }
  176. }]
  177. }
  178. },
  179. methods: {
  180. // 切换状态
  181. changeType(val) {
  182. this.$refs.pageRef.refreshList()
  183. },
  184. // 列表请求函数
  185. getList(p) {
  186. try {
  187. var pam = JSON.parse(JSON.stringify(p))
  188. if (this.examineStatus) {
  189. pam.params.push({ "param": "b.examine_status", "compare": "=", "value": this.examineStatus })
  190. }
  191. return memberListPageV2(pam)
  192. } catch (error) {
  193. console.log(error)
  194. }
  195. },
  196. // 列表导出函数
  197. exportList: memberPageExport,
  198. // 表格列解析渲染数据更改
  199. columnParsing(item, defaultData) {
  200. if (item.jname === 'idCardImg') {
  201. defaultData.render = (h, { row, index, column }) => {
  202. return (
  203. <div style="padding:0 6px;cursor: pointer;">
  204. {row.idCardImg ? row.idCardImg.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
  205. </div>
  206. )
  207. }
  208. }
  209. return defaultData
  210. },
  211. // 监听勾选变化
  212. selectionChange(data) {
  213. this.recordSelected = data
  214. },
  215. // 表格操作列
  216. operation() {
  217. return this.operationBtn({
  218. detail: {
  219. btnType: 'text',
  220. click: ({ row, index, column }) => {
  221. this.$refs.tabPage.addTab({
  222. // 对应显示的模块
  223. activeKey: "detail",
  224. // 唯一标识
  225. key: "detail",
  226. // 页签名称
  227. label: "编辑",
  228. // 打开时事件
  229. triggerEvent: () => {
  230. this.guanbi()
  231. this.$nextTick(() => {
  232. getMemberDetail({ id: row.id }).then(res => {
  233. Object.assign(this.formData, res.data)
  234. })
  235. })
  236. },
  237. // 关闭时事件
  238. closeEvent: () => {
  239. }
  240. })
  241. }
  242. },
  243. examine: {
  244. btnType: 'text',
  245. conditions: ({ row, index, column }) => {
  246. return row.examineStatus == 'WAIT'
  247. },
  248. click: ({ row, index, column }) => {
  249. this.$refs.tabPage.addTab({
  250. // 对应显示的模块
  251. activeKey: "examine",
  252. // 唯一标识
  253. key: "examine",
  254. // 页签名称
  255. label: "审核",
  256. // 打开时事件
  257. triggerEvent: () => {
  258. this.guanbi()
  259. this.$nextTick(() => {
  260. getMemberDetail({ id: row.id }).then(res => {
  261. Object.assign(this.formData, res.data)
  262. })
  263. })
  264. },
  265. // 关闭时事件
  266. closeEvent: () => {
  267. }
  268. })
  269. }
  270. },
  271. setService: {
  272. btnType: 'text',
  273. prompt: '请确认是否设为分销员?',
  274. click: ({ row, index, column }) => {
  275. memberInner({
  276. type: 'SERVICE',
  277. userIds: row.userId
  278. }).then(res => {
  279. if (res.code == 200) {
  280. this.$message({ type: 'success', message: '设为分销员成功!' })
  281. this.$refs.pageRef.refreshList()
  282. } else {
  283. this.$message.error(res.msg);
  284. }
  285. })
  286. }
  287. },
  288. setCustomer: {
  289. btnType: 'text',
  290. prompt: '请确认是否设为客户?',
  291. click: ({ row, index, column }) => {
  292. memberInner({
  293. type: 'GENERAL',
  294. userIds: row.userId
  295. }).then(res => {
  296. if (res.code == 200) {
  297. this.$message({ type: 'success', message: '设为客户成功!' })
  298. this.$refs.pageRef.refreshList()
  299. } else {
  300. this.$message.error(res.msg);
  301. }
  302. })
  303. }
  304. },
  305. })
  306. },
  307. guanbi() {
  308. this.$refs?.formRef?.$refs?.inlineForm?.clearValidate()
  309. this.$data.formData = this.$options.data().formData
  310. },
  311. audit(examineStatusEnum, removeTab) {
  312. memberAudit({
  313. examineStatusEnum,
  314. examineRemark: this.formData.examineRemark,
  315. id: this.formData.id
  316. }).then(res => {
  317. this.$message({ type: 'success', message: '审核成功!' })
  318. removeTab('list')
  319. this.$refs.pageRef.refreshList()
  320. })
  321. },
  322. }
  323. }
  324. </script>
  325. <style lang="scss" scoped>
  326. .tab {
  327. padding: 20px 20px 0 20px;
  328. }
  329. </style>