index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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="260" :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. <el-dialog title="绑定辅助师傅" width="500px" :modal="true" :visible.sync="formDialogaddsf" :show-close="true"
  22. :close-on-click-modal="false" :before-close="formCancelaa">
  23. <zj-form-container ref="formRefaa" :form-data="formDataaa" :styleSwitch="false" :formAttributes="{
  24. 'label-position': 'top'
  25. }">
  26. <zj-form-module title="绑定辅助师傅" label-width="100px" :showHade="false" :form-data="formDataaa"
  27. :form-items="formItemsaa">
  28. </zj-form-module>
  29. </zj-form-container>
  30. <div slot="footer">
  31. <el-button size="mini" @click="formCancelaa">取 消</el-button>
  32. <el-button size="mini" @click="queding">确 定</el-button>
  33. </div>
  34. </el-dialog>
  35. </template-page>
  36. </div>
  37. <div v-if="~['examine', 'detail'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
  38. <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
  39. <zj-form-module :title="data.label" label-width="100px" :showPackUp="false" :form-data="formData"
  40. :form-items="[...formItems,...imageList]">
  41. </zj-form-module>
  42. </zj-form-container>
  43. <div slot="footer" class="dialog-footer">
  44. <el-button v-if="formData.examineStatus == 'WAIT'" size="mini" type="primary"
  45. @click="audit('OK', data.removeTab)">审核通过</el-button>
  46. <el-button v-if="formData.examineStatus == 'WAIT'" size="mini" type="danger"
  47. @click="audit('FAIL', data.removeTab)">审核驳回</el-button>
  48. <el-button size="mini" @click="data.removeTab()">取 消</el-button>
  49. </div>
  50. </div>
  51. </template>
  52. </zj-tab-page>
  53. </template>
  54. <script>
  55. import TemplatePage from '@/components/template/template-page-1.vue'
  56. import import_mixin from '@/components/template/import_mixin.js'
  57. import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
  58. import { memberSlaveBind, memberListPageV2, memberPageExport, getMemberDetail, memberAudit, memberInner } from "@/api/masterManagement";
  59. import operation_mixin from '@/components/template/operation_mixin.js'
  60. export default {
  61. components: { TemplatePage },
  62. mixins: [import_mixin, operation_mixin],
  63. data() {
  64. return {
  65. // 事件组合
  66. optionsEvensGroup: [],
  67. // 表格属性
  68. tableAttributes: {
  69. // 启用勾选列
  70. selectColumn: false
  71. },
  72. // 表格事件
  73. tableEvents: {
  74. 'selection-change': this.selectionChange
  75. },
  76. // 勾选选中行
  77. recordSelected: [],
  78. /** 表单变量 */
  79. formData: {
  80. type: '工程师',
  81. examineRemark: '',
  82. examineStatus: ''
  83. },
  84. examineStatus: '',
  85. formDialogaddsf: false,
  86. formDataaa: {
  87. slaveUserId: "",
  88. userId: "",
  89. websitId: ""
  90. },
  91. suoyoushifu: [],
  92. imageList: []
  93. }
  94. },
  95. computed: {
  96. // 更多参数
  97. moreParameters() {
  98. return []
  99. },
  100. formItems() {
  101. return [{
  102. md: 12,
  103. isShow: true,
  104. name: 'el-select',
  105. options: [{ label: '待审核', value: 'WAIT' }, { label: '驳回', value: 'FAIL' }, { label: '通过', value: 'OK' }],
  106. attributes: { placeholder: '请输入', disabled: true },
  107. formItemAttributes: {
  108. label: '审核状态',
  109. prop: 'examineStatus',
  110. rules: []
  111. },
  112. }, {
  113. md: 12,
  114. isShow: true,
  115. name: 'el-input',
  116. attributes: { disabled: true },
  117. formItemAttributes: {
  118. label: '用户类型',
  119. prop: 'type',
  120. rules: []
  121. }
  122. }, {
  123. md: 12,
  124. isShow: true,
  125. name: 'el-input',
  126. attributes: { placeholder: '请输入', disabled: true },
  127. formItemAttributes: {
  128. label: '用户名称',
  129. prop: 'nickName',
  130. rules: []
  131. }
  132. }, {
  133. md: 12,
  134. isShow: true,
  135. name: 'el-input',
  136. attributes: { placeholder: '请输入', disabled: true },
  137. formItemAttributes: {
  138. label: '联系电话',
  139. prop: 'mobile',
  140. rules: []
  141. }
  142. }, {
  143. md: 12,
  144. isShow: true,
  145. name: 'el-input',
  146. attributes: { placeholder: '请输入', disabled: true },
  147. formItemAttributes: {
  148. label: '身份证号码',
  149. prop: 'idCard',
  150. rules: []
  151. }
  152. }, {
  153. md: 12,
  154. isShow: true,
  155. name: 'slot-component',
  156. attributes: {},
  157. formItemAttributes: {
  158. label: '身份证',
  159. prop: 'idCardImg',
  160. rules: []
  161. },
  162. render: (h, { props, onInput }) => {
  163. var { value } = props
  164. console.log(this.formData.idCardImg)
  165. return (
  166. this.formData.idCardImg ? <el-image src={this.formData.idCardImg} style='width: 120px;height:120px' preview-src-list={[this.formData.idCardImg]} fit="cover"></el-image> : ''
  167. )
  168. }
  169. }, {
  170. md: 12,
  171. isShow: true,
  172. name: 'el-input',
  173. attributes: { placeholder: '请输入', disabled: true },
  174. formItemAttributes: {
  175. label: '所属商户',
  176. prop: 'companyName',
  177. rules: []
  178. }
  179. }, {
  180. md: 12,
  181. isShow: true,
  182. name: 'el-input',
  183. attributes: { placeholder: '请输入', disabled: true },
  184. formItemAttributes: {
  185. label: '入驻网点',
  186. prop: 'websitName',
  187. rules: []
  188. }
  189. }, {
  190. md: 12,
  191. isShow: true,
  192. name: 'el-input',
  193. attributes: { placeholder: '请输入', disabled: true },
  194. formItemAttributes: {
  195. label: '银行卡',
  196. prop: 'bankAccount',
  197. rules: []
  198. }
  199. }, {
  200. md: 24,
  201. isShow: true,
  202. name: 'el-input',
  203. attributes: { placeholder: '请输入', type: "textarea", disabled: this.formData.examineStatus == 'WAIT' ? false : true },
  204. formItemAttributes: {
  205. label: '备注',
  206. prop: 'examineRemark',
  207. rules: []
  208. }
  209. }]
  210. },
  211. formItemsaa() {
  212. return [{
  213. md: 24,
  214. isShow: true,
  215. name: 'el-select',
  216. options: this.suoyoushifu,
  217. attributes: { placeholder: '请输入' },
  218. formItemAttributes: {
  219. label: '选择师傅',
  220. prop: 'slaveUserId',
  221. rules: [...required]
  222. },
  223. events: {
  224. change: (val) => {
  225. if (val) {
  226. this.formDataaa.websitId = this.suoyoushifu.find(item => item.value == val)?.websitId
  227. } else {
  228. this.formDataaa.websitId = ""
  229. }
  230. }
  231. }
  232. },]
  233. }
  234. },
  235. methods: {
  236. queding() {
  237. this.$refs.formRefaa.validate((valid, invalidFields, errLabels) => {
  238. if (valid) {
  239. memberSlaveBind(this.formDataaa).then(res => {
  240. this.$message({
  241. type: 'success',
  242. message: '绑定成功成功'
  243. })
  244. this.formCancelaa()
  245. this.$refs.pageRef.refreshList()
  246. })
  247. }
  248. })
  249. },
  250. formCancelaa() {
  251. this.$refs?.formRefaa?.$refs?.inlineForm?.clearValidate()
  252. this.$data.formDataaa = this.$options.data().formDataaa
  253. this.formDialogaddsf = false
  254. },
  255. // 切换状态
  256. changeType(val) {
  257. this.$refs.pageRef.refreshList()
  258. },
  259. // 列表请求函数
  260. getList(p) {
  261. try {
  262. var pam = JSON.parse(JSON.stringify(p))
  263. if (this.examineStatus) {
  264. pam.params.push({ "param": "b.examine_status", "compare": "=", "value": this.examineStatus })
  265. }
  266. return memberListPageV2(pam)
  267. } catch (error) {
  268. console.log(error)
  269. }
  270. },
  271. // 列表导出函数
  272. exportList: memberPageExport,
  273. // 表格列解析渲染数据更改
  274. columnParsing(item, defaultData) {
  275. if (item.jname === 'idCardImg') {
  276. defaultData.render = (h, { row, index, column }) => {
  277. return (
  278. <div style="padding:0 6px;cursor: pointer;">
  279. {row.idCardImg ? row.idCardImg.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
  280. </div>
  281. )
  282. }
  283. }
  284. return defaultData
  285. },
  286. // 监听勾选变化
  287. selectionChange(data) {
  288. this.recordSelected = data
  289. },
  290. // 表格操作列
  291. operation() {
  292. return this.operationBtn({
  293. detail: {
  294. btnType: 'text',
  295. click: ({ row, index, column }) => {
  296. this.$refs.tabPage.addTab({
  297. activeKey: "detail",
  298. key: "detail",
  299. label: "详情",
  300. triggerEvent: () => {
  301. this.guanbi()
  302. this.imageList = []
  303. this.$nextTick(() => {
  304. getMemberDetail({ id: row.id }).then(res => {
  305. Object.assign(this.formData, res.data)
  306. res.data.workerImgList.forEach(item=>{
  307. this.imageList.push({
  308. md: 12,
  309. isShow: true,
  310. name: 'slot-component',
  311. attributes: {},
  312. formItemAttributes: {
  313. label: item.imgName,
  314. prop: 'imgName',
  315. rules: []
  316. },
  317. render: (h, { props, onInput }) => {
  318. var { value } = props
  319. return (
  320. item.imgUrl ? <el-image src={item.imgUrl} style='width: 120px;height:120px' preview-src-list={[item.imgUrl]} fit="cover"></el-image> : ''
  321. )
  322. }
  323. })
  324. })
  325. })
  326. })
  327. },
  328. closeEvent: () => {
  329. }
  330. })
  331. }
  332. },
  333. examine: {
  334. btnType: 'text',
  335. conditions: ({ row, index, column }) => {
  336. return row.examineStatus == 'WAIT'
  337. },
  338. click: ({ row, index, column }) => {
  339. this.$refs.tabPage.addTab({
  340. activeKey: "examine",
  341. key: "examine",
  342. label: "审核",
  343. triggerEvent: () => {
  344. this.guanbi()
  345. this.$nextTick(() => {
  346. getMemberDetail({ id: row.id }).then(res => {
  347. Object.assign(this.formData, res.data)
  348. })
  349. })
  350. },
  351. closeEvent: () => {
  352. }
  353. })
  354. }
  355. },
  356. setService: {
  357. btnType: 'text',
  358. prompt: '请确认是否设为分销员?',
  359. click: ({ row, index, column }) => {
  360. memberInner({
  361. type: 'SERVICE',
  362. userId: row.userId
  363. }).then(res => {
  364. if (res.code == 200) {
  365. this.$message({ type: 'success', message: '设为分销员成功!' })
  366. this.$refs.pageRef.refreshList()
  367. } else {
  368. this.$message.error(res.msg);
  369. }
  370. })
  371. }
  372. },
  373. setCustomer: {
  374. btnType: 'text',
  375. prompt: '请确认是否设为客户?',
  376. click: ({ row, index, column }) => {
  377. memberInner({
  378. type: 'GENERAL',
  379. userId: row.userId
  380. }).then(res => {
  381. if (res.code == 200) {
  382. this.$message({ type: 'success', message: '设为客户成功!' })
  383. this.$refs.pageRef.refreshList()
  384. } else {
  385. this.$message.error(res.msg);
  386. }
  387. })
  388. }
  389. },
  390. bindWorker: {
  391. btnType: 'text',
  392. conditions: ({ row, index, column }) => {
  393. return row.examineStatus == 'OK'
  394. },
  395. click: ({ row, index, column }) => {
  396. memberListPageV2({ "pageNum": 1, "pageSize": -1, "params": [{"param":"b.examine_status","compare":"=","value":"OK"},{"param":"b.websit_id","compare":"=","value": row.websitId}] }).then(res => {
  397. this.suoyoushifu = res.data.records.filter(item => item.id != row.id).map(item => ({
  398. label: item.nickName,
  399. value: item.userId,
  400. websitId: item.websitId
  401. }))
  402. this.formDataaa.userId = row.userId
  403. this.formDialogaddsf = true
  404. })
  405. }
  406. },
  407. })
  408. },
  409. guanbi() {
  410. this.$refs?.formRef?.$refs?.inlineForm?.clearValidate()
  411. this.$data.formData = this.$options.data().formData
  412. },
  413. audit(examineStatusEnum, removeTab) {
  414. memberAudit({
  415. examineStatusEnum,
  416. examineRemark: this.formData.examineRemark,
  417. id: this.formData.id
  418. }).then(res => {
  419. this.$message({ type: 'success', message: '审核成功!' })
  420. removeTab('list')
  421. this.$refs.pageRef.refreshList()
  422. })
  423. },
  424. }
  425. }
  426. </script>
  427. <style lang="scss" scoped>
  428. .tab {
  429. padding: 20px 20px 0 20px;
  430. }
  431. </style>