index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="280"
  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. <!-- 入驻网点 -->
  29. <el-dialog title="设为工程师" :visible.sync="dialogVisible" @close="websitList = []" width="50%" :close-on-click-modal="false" :modal-append-to-body="false">
  30. <el-form ref="workerForm" :model="workerForm" label-width="110px" size="small" label-position="left">
  31. <el-row :gutter="20">
  32. <el-col :span="24">
  33. <el-form-item label="入驻网点" :required="true">
  34. <el-select v-model="workerForm.websitId" placeholder="请选择" style="width: 100%;">
  35. <el-option
  36. v-for="item in websitList"
  37. :key="item.websitId"
  38. :label="item.name"
  39. :value="item.websitId">
  40. </el-option>
  41. </el-select>
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. </el-form>
  46. <div slot="footer" class="dialog-footer">
  47. <el-button @click="dialogVisible = false">取 消</el-button>
  48. <el-button type="primary" @click="memberInner()">确定</el-button>
  49. </div>
  50. </el-dialog>
  51. </template-page>
  52. </template>
  53. <script>
  54. import TemplatePage from '@/components/template/template-page-1.vue'
  55. import import_mixin from '@/components/template/import_mixin.js'
  56. import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
  57. import { memberListService2,memberPageExport, getMemberDetail, memberAudit, memberInner, memberInsideInner, getWebsit } from "@/api/distributorManagement";
  58. import operation_mixin from '@/components/template/operation_mixin.js'
  59. export default {
  60. components: { TemplatePage },
  61. mixins: [import_mixin,operation_mixin],
  62. data() {
  63. return {
  64. // 事件组合
  65. optionsEvensGroup: [],
  66. // 表格属性
  67. tableAttributes: {
  68. // 启用勾选列
  69. selectColumn: false,
  70. },
  71. // 表格事件
  72. tableEvents: {
  73. 'selection-change': this.selectionChange
  74. },
  75. // 勾选选中行
  76. recordSelected: [],
  77. /** 表单变量 */
  78. formDialogType: 0,
  79. formDialogTitles: ["审核", "详情"],
  80. formDialog: false,
  81. dialogVisible: false,
  82. formData: {
  83. type: '工程师',
  84. examineRemark: ''
  85. },
  86. examineStatus: '',
  87. websitList: [],
  88. workerForm: {
  89. websitId: '',
  90. userId: '',
  91. }
  92. }
  93. },
  94. computed: {
  95. // 更多参数
  96. moreParameters() {
  97. return []
  98. },
  99. formItems() {
  100. return [{
  101. md: 12,
  102. isShow: true,
  103. name: 'el-select',
  104. options: [{label: '待审核', value: 'WAIT'},{label: '驳回', value: 'FAIL'},{label: '通过', value: 'OK'}],
  105. attributes: { placeholder: '请输入', disabled: true },
  106. formItemAttributes: {
  107. label: '审核状态',
  108. prop: 'examineStatus',
  109. rules: []
  110. },
  111. }, {
  112. md: 12,
  113. isShow: true,
  114. name: 'el-select',
  115. options: [{label: '业务员', value: 'SERVICE'},{label: '师傅', value: 'WORKER'},{label: '普通用户', value: 'GENERAL'}],
  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: 'el-image',
  156. attributes: { src: this.formData.idCardImg },
  157. formItemAttributes: {
  158. label: '身份证',
  159. prop: 'idCardImg',
  160. rules: []
  161. },
  162. }, {
  163. md: 12,
  164. isShow: true,
  165. name: 'el-input',
  166. attributes: { placeholder: '请输入', disabled: true },
  167. formItemAttributes: {
  168. label: '所属商户',
  169. prop: 'companyName',
  170. rules: []
  171. }
  172. }, {
  173. md: 24,
  174. isShow: true,
  175. name: 'el-input',
  176. attributes: { placeholder: '请输入',type: "textarea", disabled: this.formData.examineStatus == 'WAIT' ? false:true },
  177. formItemAttributes: {
  178. label: '备注',
  179. prop: 'examineRemark',
  180. rules: []
  181. }
  182. }]
  183. }
  184. },
  185. methods: {
  186. // 切换状态
  187. changeType(val) {
  188. this.$refs.pageRef.refreshList()
  189. },
  190. // 列表请求函数
  191. getList(p) {
  192. try {
  193. var pam = JSON.parse(JSON.stringify(p))
  194. if (this.examineStatus) {
  195. pam.params.push({ "param": "a.examine_status", "compare": "=", "value": this.examineStatus })
  196. }
  197. return memberListService2(pam)
  198. } catch (error) {
  199. console.log(error)
  200. }
  201. },
  202. // 列表导出函数
  203. exportList: memberPageExport,
  204. // 表格列解析渲染数据更改
  205. columnParsing(item, defaultData) {
  206. if (item.jname === 'idCardImg') {
  207.     defaultData.render = (h, { row, index, column }) => {
  208.       return (
  209.         <div style="padding:0 6px;cursor: pointer;">
  210.           {row.idCardImg ? row.idCardImg.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
  211.           </div>
  212.       )
  213.     }
  214. }
  215. return defaultData
  216. },
  217. // 监听勾选变化
  218. selectionChange(data) {
  219. this.recordSelected = data
  220. },
  221. // 表格操作列
  222. operation() {
  223. return this.operationBtn({
  224. detail: {
  225. btnType: 'text',
  226. click: ({ row, index, column }) => {
  227. getMemberDetail({ userId: row.userId }).then(res => {
  228. Object.assign(this.formData, res.data)
  229. this.formDialogType = 1
  230. this.openForm()
  231. })
  232. }
  233. },
  234. examine: {
  235. btnType: 'text',
  236. conditions: ({ row, index, column }) => {
  237. return row.examineStatus == 'WAIT'
  238. },
  239. click: ({ row, index, column }) => {
  240. getMemberDetail({ userId: row.userId }).then(res => {
  241. Object.assign(this.formData, res.data)
  242. this.formDialogType = 0
  243. this.openForm()
  244. })
  245. }
  246. },
  247. setWorker: {
  248. btnType: 'text',
  249. prompt: '请确认是否设为工程师?',
  250. conditions: ({ row, index, column }) => {
  251. return row.examineStatus != 'WAIT'
  252. },
  253. click: ({ row, index, column }) => {
  254. this.workerForm.userId = row.userId
  255. getWebsit({type: 'C'}).then(res => {
  256. this.websitList = res.data
  257. this.dialogVisible = true
  258. })
  259. }
  260. },
  261. setCustomer: {
  262. btnType: 'text',
  263. prompt: '请确认是否设为客户?',
  264. click: ({ row, index, column }) => {
  265. memberInner({
  266. type: 'GENERAL',
  267. userIds: row.userId
  268. }).then(res => {
  269. if (res.code == 200) {
  270. this.$message({ type: 'success', message: '设为客户成功!' })
  271. this.$refs.pageRef.refreshList()
  272. } else {
  273. this.$message.error(res.msg);
  274. }
  275. })
  276. }
  277. },
  278. setService: {
  279. name: ({ row, index, column }) => {
  280. return `${row.innerr?'取消':'设为'}内部分销员`
  281. },
  282. btnType: 'text',
  283. prompt: ({ row, index, column }) => {
  284. return `请确认是否${row.innerr?'取消':'设为'}内部分销员?`
  285. },
  286. click: ({ row, index, column }) => {
  287. memberInsideInner({
  288. innerr: !row.innerr,
  289. userIds: row.userId
  290. }).then(res => {
  291. if (res.code == 200) {
  292. this.$message({ type: 'success', message: (row.innerr?'取消':'设为')+ '内部分销员成功!' })
  293. this.$refs.pageRef.refreshList()
  294. } else {
  295. this.$message.error(res.msg);
  296. }
  297. })
  298. }
  299. },
  300. })
  301. },
  302. addData() {
  303. this.formDialogType = 0
  304. this.openForm()
  305. },
  306. openForm() {
  307. this.formDialog = true;
  308. },
  309. formCancel() {
  310. this.$refs.formRef.$refs.inlineForm.clearValidate()
  311. this.$data.formData = this.$options.data().formData
  312. this.formDialog = false
  313. },
  314. audit(examineStatusEnum){
  315. memberAudit({
  316. examineStatusEnum,
  317. examineRemark: this.formData.examineRemark,
  318. id: this.formData.id,
  319. userId: this.workerForm.userId,
  320. }).then(res => {
  321. this.$message({ type: 'success', message: '审核成功!' })
  322. this.formCancel()
  323. this.$refs.pageRef.refreshList()
  324. })
  325. },
  326. memberInner(){
  327. if(!this.workerForm.websitId){
  328. return this.$message({ type: 'danger', message: '请选择入驻网点!' })
  329. }
  330. memberInner({
  331. type: 'WORKER',
  332. userIds: this.workerForm.userId,
  333. websitId: this.workerForm.websitId
  334. }).then(res => {
  335. this.dialogVisible = false
  336. this.$message({ type: 'success', message: '设置工程师成功!' })
  337. this.$refs.pageRef.refreshList()
  338. })
  339. },
  340. formConfirm() {
  341. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  342. if (valid) {
  343. ([memberAudit][this.formDialogType])(this.formData).then(res => {
  344. this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
  345. this.formCancel()
  346. this.$refs.pageRef.refreshList()
  347. })
  348. }
  349. })
  350. }
  351. }
  352. }
  353. </script>
  354. <style lang="scss" scoped></style>